]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
10 months agoRISC-V: Support long double math
Kito Cheng [Mon, 4 Dec 2023 07:41:39 +0000 (15:41 +0800)]
RISC-V: Support long double math

Long double for RISC-V is using 128 bit IEEE 754 format like Aarch64,
so we reference AArch64 to support that.

10 months agoRISC-V: Fix -Wint-conversion warning
Kito Cheng [Mon, 4 Dec 2023 07:41:28 +0000 (15:41 +0800)]
RISC-V: Fix -Wint-conversion warning

Upstream GCC has change this warning into error by default, so...we need
to explicitly convert the type from pointer from/to integer, generally
it's unsafe, but we know what we are doing here.

However it's not safe for ilp32 on RV64, but we didn't support that yet, so I
think this fix is good enough now :)

10 months agoCygwin: fallocate(2): drop useless zeroing pointer
Corinna Vinschen [Sat, 2 Dec 2023 13:38:28 +0000 (14:38 +0100)]
Cygwin: fallocate(2): drop useless zeroing pointer

The out pointer is only used if data_chunk_count is > 0,
so there's no reason to set it to NULL in the error case.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: CI: drop IRC notification from AppVeyor via notifico
Jon Turney [Fri, 24 Nov 2023 13:17:32 +0000 (13:17 +0000)]
Cygwin: CI: drop IRC notification from AppVeyor via notifico

Drop IRC status notification from AppVeyor via notifico, as we no longer
run tests there.

11 months agonewlib: libc: Fix indentation
Kuan-Wei Chiu [Sat, 2 Dec 2023 04:21:07 +0000 (12:21 +0800)]
newlib: libc: Fix indentation

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
11 months agonewlib: libc: Fix memory leak in computematchjumps()
Kuan-Wei Chiu [Fri, 1 Dec 2023 16:13:21 +0000 (00:13 +0800)]
newlib: libc: Fix memory leak in computematchjumps()

In cases where malloc fails for the 'g->matchjump' allocation, the code
path does not handle the failure gracefully, potentially leading to a
memory leak. This fix ensures proper cleanup by freeing the allocated
memory for 'pmatches' before returning.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
11 months agoCygwin: drop stray fs_info::check_ssd declaration
Corinna Vinschen [Fri, 1 Dec 2023 08:55:33 +0000 (09:55 +0100)]
Cygwin: drop stray fs_info::check_ssd declaration

This is just a leftover from development

Fixes: 8b01c5d6903f ("Cygwin: fs_info: check for SSD")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: doc: add missing change to posix_spawnp
Corinna Vinschen [Thu, 30 Nov 2023 21:38:59 +0000 (22:38 +0100)]
Cygwin: doc: add missing change to posix_spawnp

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: sparse support: enable automatic sparsifying of files on SSDs
Corinna Vinschen [Thu, 30 Nov 2023 21:36:35 +0000 (22:36 +0100)]
Cygwin: sparse support: enable automatic sparsifying of files on SSDs

Given that SSDs don't have a seek penalty, we can enable
automatic sparsifying of files on SSDs, even if the "sparse"
mount option is not set.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: fs_info: check for SSD
Corinna Vinschen [Thu, 30 Nov 2023 21:13:49 +0000 (22:13 +0100)]
Cygwin: fs_info: check for SSD

During fs_info::update, check for the file being on an SSD.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: ntdll.h: add missing NtQueryVolumeInformationFile definitions
Corinna Vinschen [Thu, 30 Nov 2023 21:12:13 +0000 (22:12 +0100)]
Cygwin: ntdll.h: add missing NtQueryVolumeInformationFile definitions

In preparation of using the FileFsSectorSizeInformation info class,
add a couple of missing definitions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: ntdll.h: add missing POBJECT_NAME_INFORMATION
Corinna Vinschen [Thu, 30 Nov 2023 21:11:26 +0000 (22:11 +0100)]
Cygwin: ntdll.h: add missing POBJECT_NAME_INFORMATION

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: revert autoloading of DiscardVirtualMemory
Corinna Vinschen [Thu, 30 Nov 2023 20:14:48 +0000 (21:14 +0100)]
Cygwin: revert autoloading of DiscardVirtualMemory

Commit a3ae2a734892 ("Cygwin: don't autoload some kernel32 functions")
erroneously removed DiscardVirtualMemory from the list of autloaded
functions.  DiscardVirtualMemory is not available on Windows 8.1.

Fixes: a3ae2a734892 ("Cygwin: don't autoload some kernel32 functions")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: Add '--names-only' flag to cygcheck
Jon Turney [Fri, 24 Nov 2023 16:17:05 +0000 (16:17 +0000)]
Cygwin: Add '--names-only' flag to cygcheck

Add '--names-only' flag to cygcheck, to output just the bare package
names.

11 months agoRISC-V: Fix timeval conversion in _gettimeofday()
Kuan-Wei Chiu [Wed, 29 Nov 2023 03:57:14 +0000 (11:57 +0800)]
RISC-V: Fix timeval conversion in _gettimeofday()

Replace multiplication with division for microseconds calculation from
nanoseconds in _gettimeofday function.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
11 months agonewlib: filter out versions from newlib.h to simplify autoreconf
Mike Frysinger [Sun, 15 Oct 2023 09:29:13 +0000 (15:14 +0545)]
newlib: filter out versions from newlib.h to simplify autoreconf

We've been manually editing newlib.hin after generating it with
autoheader to drop the version defines that we keep in the separate
_newlib_version.h header.  This is confusing for people, and is an
easy source of mistakes/errors.

Since we're already running sed on newlib.h during configure to
filter out defines we don't want to expose, add the version macros
there too.  This way we don't have to manually edit newlib.hin.

This simplifies the autoreconf step in exchange for a slightly more
complicated configure+sed step, but seems worth the trade-off.

11 months agoCygwin: fallocate(2): handle FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE
Corinna Vinschen [Tue, 28 Nov 2023 09:42:52 +0000 (10:42 +0100)]
Cygwin: fallocate(2): handle FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE

Split fhandler_disk_file::fallocate into multiple methods, each
implementing a different aspect of fallocate(2), thus adding
FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE handling.

For more correctly implementing posix_fallocate(3) semantics, make
sure to re-allocate holes in the given range if the file is sparse.

While at it, change the way checking when to make a file sparse.
The rule is now, make file sparse if the hole created by the action
spans at least one sparse block, taking the allocation granularity
of sparse files into account.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: pwrite(2): sparsify file
Corinna Vinschen [Mon, 27 Nov 2023 21:48:50 +0000 (22:48 +0100)]
Cygwin: pwrite(2): sparsify file

write(2) sparsifies a file after an lseek far enough beyond EOF.

Let pwrite(2) sparsify as well if offset is far enough beyond EOF.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: fallocate(2): fix evaluating return value
Corinna Vinschen [Mon, 27 Nov 2023 20:17:12 +0000 (21:17 +0100)]
Cygwin: fallocate(2): fix evaluating return value

fallocate is not supposed to return an errno code, it has to
return -1 and set errno.

Fixes: dd90ede40510 ("Cygwin: introduce fallocate(2)")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: open(2): reset sparseness on O_TRUNCated files
Corinna Vinschen [Mon, 27 Nov 2023 20:14:49 +0000 (21:14 +0100)]
Cygwin: open(2): reset sparseness on O_TRUNCated files

open(2) implements O_TRUNC by just reducing the size of the file
to 0, to make sure EAs stay available.

Turns out, file sparseness is not removed this way either, so add
code to do just that.

Fixes: 603ef545bdbd ("* fhandler.cc (fhandler_base::open): Never open files with FILE_OVERWITE/FILE_OVERWRITE_IF.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: introduce fallocate(2)
Corinna Vinschen [Sun, 26 Nov 2023 20:05:07 +0000 (21:05 +0100)]
Cygwin: introduce fallocate(2)

First cut of the new, Linux-specific fallocate(2) function.
Do not add any functionality yet, except of basic handling
of FALLOC_FL_KEEP_SIZE.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: fcntl.h: Use cdefs.h macros
Corinna Vinschen [Sun, 26 Nov 2023 14:41:41 +0000 (15:41 +0100)]
Cygwin: fcntl.h: Use cdefs.h macros

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: fhandler: rename ftruncate method to fallocate
Corinna Vinschen [Sun, 26 Nov 2023 11:50:38 +0000 (12:50 +0100)]
Cygwin: fhandler: rename ftruncate method to fallocate

also, take mode flags parameter instead of just a bool.
Introduce __FALLOC_FL_TRUNCATE mode flag as internal flag to
indictae being called from ftruncate(2).

This is in preparation of an upcoming change introducing the
Linx-specific fallocate(2) call.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: posix_fallocate: return ENODEV
Corinna Vinschen [Sat, 25 Nov 2023 19:56:52 +0000 (20:56 +0100)]
Cygwin: posix_fallocate: return ENODEV

The fhandler method ftruncate returns either EISDIR if it has been
called on directories, or EINVAL if called on files other than
regular files.  This matches what ftruncate(2) is supposed to return,
but it doesn't match posix_fallocate(3), which is supposed to return
ENODEV in both cases.

To accomplish that, return ENODEV from fhandler_base::ftruncate()
and convert it to EINVAL in ftruncate(2). In posix_fallocate(3),
convert EISDIR to ENODEV.

Fixes: 7636b58590621 ("* autoload.cc (NtSetInformationFile): Define.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: lseek: check for file sparseness, not for mount point sparseness
Corinna Vinschen [Sat, 25 Nov 2023 17:07:10 +0000 (18:07 +0100)]
Cygwin: lseek: check for file sparseness, not for mount point sparseness

The code introducing the lseek(2) code for the GNU extensions
SEEK_DATA and SEEK_HOLE accidentally checks if the mount point
has the "sparse" flag set and, if not, emulates SEEK_DATA/SEEK_HOLE
per the Linux specs.

However, the mount point "sparse" flag only determines whether
files should be made sparse or not.  Files may be sparse independently
of that, obviously.

Fix that by checking for the FILE_ATTRIBUTE_SPARSE_FILE attribute
instead.

Fixes: edfa581d3c5a ("Cygwin: lseek: implement SEEK_DATA and SEEK_HOLE for files")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agonewlib: nl_langinfo: Fix a bug of time stuff.
Takashi Yano [Thu, 23 Nov 2023 11:00:55 +0000 (20:00 +0900)]
newlib: nl_langinfo: Fix a bug of time stuff.

Previously, e.g. nl_langinfo(_NL_TIME_WMONTH_1) returns "February"
due to the bug. Similarly, nl_langinfo(_NL_TIME_WWDAY_1) returns
"Mon". This occurs because wide char month and weekday arrays are
pointed off-by-one (e.g. the array wmon[12] is reffered as wmon[1-12]
rather than wmon[0-11]). This patch fixes that.

Fixes: d47d5b850bed ("Extend locale support to maintain wide char values of native strings")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
11 months agoCygwin: /dev/disk: Append '#N' if the same name appears more than once
Christian Franke [Tue, 21 Nov 2023 18:28:02 +0000 (19:28 +0100)]
Cygwin: /dev/disk: Append '#N' if the same name appears more than once

No longer drop ranges of identical link names.  Append '#0, #1, ...'
to each name instead.  Enhance charset allowed in label names.
No longer ignore null volume serial numbers.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months agoaarch64: Remove duplicated optimized memmove()
Sebastian Huber [Fri, 27 Oct 2023 16:25:35 +0000 (18:25 +0200)]
aarch64: Remove duplicated optimized memmove()

The optimized aarch64/memcpy.S already provides a memmove() implementation.

11 months agostdio: drop unnecessary calls to ORIENT
Corinna Vinschen [Mon, 20 Nov 2023 19:49:53 +0000 (20:49 +0100)]
stdio: drop unnecessary calls to ORIENT

Now that the low-level functions set and test stream orientation,
a few calls in API functions are redundant.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agostdio: set and test stream orientation in low-level input function __srget_r
Corinna Vinschen [Mon, 20 Nov 2023 19:47:52 +0000 (20:47 +0100)]
stdio: set and test stream orientation in low-level input function __srget_r

This allows to set and test orientation correctly if input is only
using macros from stdio.h.  Wide-char-oriented functions must call
__srefill_r directly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agostdio: split byte- and wide-char-oriented low-level output functions
Corinna Vinschen [Mon, 20 Nov 2023 19:46:14 +0000 (20:46 +0100)]
stdio: split byte- and wide-char-oriented low-level output functions

Introduce function __swbufw_r and macros/inline-functions called
__swputc_r.  Call these functions/macros exclusively from wide-char
functions.

This allows to set and test the stream orientation correctly even if
output is only performed using byte-oriented macros from stdio.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agostdio: Fix bugs in commit 3d94e07c49b5
Takashi Yano [Fri, 10 Nov 2023 16:09:47 +0000 (01:09 +0900)]
stdio: Fix bugs in commit 3d94e07c49b5

The commit 3d94e07c49b5 has a few bugs which cause testsuite failure
in libstdc++. This is due to excess orientation check in __srefill_r()
and _ungetc_r(). Further, sscanf() family also calls ssvfscanf() family
with fp->_file == -1. This causes undesired orientation set/check for
sscanf() family. This patch fixes these problems.

Also, as in GLibC, do not set orientation in ungetc, and only set, but
do not check orientation in ungetwc.

Fixes: 3d94e07c49b5 ("newlib: libc: Fix crash on fprintf to a wide-oriented stream.")
Reported-by: Christophe Lyon <christophe.lyon@linaro.org>
Reported-by: Joel Sherrill <joel@rtems.org>
Co-developed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: /dev/disk/by-uuid: Fix NTFS serial number print format
Christian Franke [Mon, 20 Nov 2023 14:40:42 +0000 (15:40 +0100)]
Cygwin: /dev/disk/by-uuid: Fix NTFS serial number print format

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months agoReclaim _REENT_MP_P5S in _reclaim_reent
Chris Johns [Mon, 20 Nov 2023 01:04:58 +0000 (12:04 +1100)]
Reclaim _REENT_MP_P5S in _reclaim_reent

The _REENT_MP_P5S blocks are allocated using Balloc via i2b and linked in the
pow5mult call. As a result these blocks are not on the freelist managed by the
Bfree call. This change fixes a memory leak in threads that clean up using
_reclaim_reent.

RTEMS: Closes #4967

11 months agoCygwin: Document /dev/disk/by-* subdirectories
Christian Franke [Fri, 17 Nov 2023 17:41:08 +0000 (18:41 +0100)]
Cygwin: Document /dev/disk/by-* subdirectories

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months agoCygwin: Add /dev/disk/by-label and /dev/disk/by-uuid symlinks
Christian Franke [Fri, 17 Nov 2023 14:22:52 +0000 (15:22 +0100)]
Cygwin: Add /dev/disk/by-label and /dev/disk/by-uuid symlinks

The new directories '/dev/disk/by-label' and '/dev/disk/by-uuid'
provide symlinks for each disk related volume label and serial
number:
'VOLUME_LABEL' -> '../../sdXN'
'VOLUME_SERIAL' -> '../../sdXN'

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months ago__sfvwrite_r: call __sputc_r rather than putc in __SCLE case
Corinna Vinschen [Fri, 17 Nov 2023 16:00:54 +0000 (17:00 +0100)]
__sfvwrite_r: call __sputc_r rather than putc in __SCLE case

__sfvwrite_r is called under lock.  There's no reason to call
putc, locking the file recursively.  Add a comment that locking
is required when calling __sfvwrite_r.

Fixes: 49d64538cd20 ("* libc/include/stdio.h (FILE): define __SCLE for "convert line endings" for Cygwin.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agov{fs}printf/v{fs}wprintf: create external output helpers
Corinna Vinschen [Thu, 16 Nov 2023 19:34:55 +0000 (20:34 +0100)]
v{fs}printf/v{fs}wprintf: create external output helpers

So far, the printf family of functions has two output helper functions
called __sprint_r and __sfputs_r.  Both are called from all variants of
vfprintf as well as vfwprintf.  There are also analogue helper functions
 for the string-creating functions vsprintf/vswprintf called __ssprint_r
and __ssputs_r.

However, the helpers are built once when building vfprintf/vsprintf with
the INTEGER_ONLY flag, and then they are part of the vfiprintf.c and
vsiprintf.c files.

The problem is this:

Even if a process only calls vfwprintf or the non-INTEGER_ONLY vfprintf
it will always have to include the INTEGER_ONLY vfiprintf. Otherwise the
helper functions are undefined.  Analogue for the string-creating
functions.

That's a useless waste of space by including one (or two) big, unused
function, if newlib is linked in statically.

Create new files to define the printf output helpers separately and
split them into byte-oriented and wide-char-oriented functions.  This
allows to link only the required functions.

Also, simplify the string output helpers and fix a potential (but
unlikely) buffer overflow in __ssprint_r.

Fixes: 8a0efa53e449 ("import newlib-2000-02-17 snapshot")
Fixes: 6121968b198d ("* libc/include/stdio.h (__VALIST): Guard against multiple definition.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agonewlib.hin: regenerate
Corinna Vinschen [Thu, 16 Nov 2023 19:06:19 +0000 (20:06 +0100)]
newlib.hin: regenerate

The last two patches to configure.ac missed regeneration of newlib.hin.

Fixes: 64a11fded15b ("Fix problem with _newlib_version.h not being filled in correctly")
Fixes: 39f734a857e2 ("newlib: fix AC_DEFINE quoting style with version macros")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: Add /dev/disk/by-drive and /dev/disk/by-voluuid symlinks
Christian Franke [Thu, 16 Nov 2023 16:51:08 +0000 (17:51 +0100)]
Cygwin: Add /dev/disk/by-drive and /dev/disk/by-voluuid symlinks

The new directory '/dev/disk/by-drive' provides symlinks for each
disk related drive letter:
'x' -> '../../sdXN'
The new directory '/dev/disk/by-voluuid' provides symlinks for each
disk related storage volume:
'MBR_SERIAL-OFFSET' -> '../../sdXN'
'VOLUME_GUID' -> '../../sdXN'
Both directories provide Windows specific information and do not
exist on Linux.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months agoCygwin: rand(3): implement in terms of random(3)
Corinna Vinschen [Tue, 14 Nov 2023 16:52:48 +0000 (17:52 +0100)]
Cygwin: rand(3): implement in terms of random(3)

This makes rand(3) ISO C compliant and adds locking to avoid
race conditions.

Reported-by: Bruno Haible <bruno@clisp.org>
Fixes: 8a0efa53e4491 ("import newlib-2000-02-17 snapshot")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoFix profiler error() definition and usage
Mark Geisert [Tue, 14 Nov 2023 08:58:33 +0000 (00:58 -0800)]
Fix profiler error() definition and usage

Minor updates to profiler and gmondump, which share some code:
- fix operation of error() so it actually works as intended
- resize 4K-size auto buffer reservations to BUFSIZ (==1K)
- remove trailing '\n' from 2nd arg on error() calls everywhere
- provide consistent annotation of Windows error number displays

Fixes: 9887fb27f6126 ("Cygwin: New tool: profiler")
Fixes: 087a3d76d7335 ("Cygwin: New tool: gmondump")
Signed-off-by: Mark Geisert <mark@maxrnd.com>
11 months agoAdd release text for random(3) fix
Corinna Vinschen [Mon, 13 Nov 2023 19:01:36 +0000 (20:01 +0100)]
Add release text for random(3) fix

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: random: drop unused function srandomdev()
Corinna Vinschen [Mon, 13 Nov 2023 18:37:56 +0000 (19:37 +0100)]
Cygwin: random: drop unused function srandomdev()

Also drop includes only required for srandomdev().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agoCygwin: random: make random(3) functions thread-safe
Corinna Vinschen [Mon, 13 Nov 2023 18:41:08 +0000 (19:41 +0100)]
Cygwin: random: make random(3) functions thread-safe

Add locking to the random(3) family of functions to gain
thread-safety per POSIX. Use NetBSD version of the file as
role-model.

Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
11 months agonewlib: libc: Fix crash on fprintf to a wide-oriented stream.
Takashi Yano [Thu, 5 Oct 2023 15:04:49 +0000 (00:04 +0900)]
newlib: libc: Fix crash on fprintf to a wide-oriented stream.

Previously, fprintf() on a wide-oriented stream crashes or outputs
garbage. This is because a narrow char string which can be odd bytes
in length is cast into a wide char string which should be even
bytes in length in __sprint_r/__sfputs_r based on the __SWID flag.
As a result, if the length is odd bytes, the reading buffer runs over
the buffer length, which causes a crash. If the length is even bytes,
garbage is printed.

With this patch, any output to the stream which is set to different
orientation fails with error just like glibc. Note that it behaves
differently from other libc implementations such as BSD, musl and
Solaris.

Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
11 months agoCygwin: /dev/disk/by-id: Remove leading spaces from identify fields
Christian Franke [Wed, 8 Nov 2023 16:03:57 +0000 (17:03 +0100)]
Cygwin: /dev/disk/by-id: Remove leading spaces from identify fields

Various drives align the serial number to the right of the fixed
length field.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months agoCygwin: Document /dev/disk/by-id and /dev/disk/by-partuuid
Christian Franke [Tue, 7 Nov 2023 14:25:54 +0000 (15:25 +0100)]
Cygwin: Document /dev/disk/by-id and /dev/disk/by-partuuid

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months agoCygwin: Add /dev/disk/by-partuuid symlinks
Christian Franke [Tue, 7 Nov 2023 09:57:15 +0000 (10:57 +0100)]
Cygwin: Add /dev/disk/by-partuuid symlinks

The new directory '/dev/disk/by-partuuid' provides symlinks for each
MBR or GPT disk partition:
'MBR_SERIAL-OFFSET' -> '../../sdXN'
'GPT_GUID' -> '../../sdXN'

Signed-off-by: Christian Franke <christian.franke@t-online.de>
11 months agoCygwin: Add /dev/disk/by-id symlinks
Christian Franke [Sun, 5 Nov 2023 14:54:23 +0000 (15:54 +0100)]
Cygwin: Add /dev/disk/by-id symlinks

The new directory '/dev/disk/by-id' provides symlinks for each
disk and its partitions:
'BUSTYPE-[VENDOR_]PRODUCT_SERIAL[-partN]' -> '../../sdX[N]'.
This is based on strings provided by STORAGE_DEVICE_DESCRIPTOR.
If this information is too short, a 128-bit hash of the
STORAGE_DEVICE_UNIQUE_IDENTIFIER raw data is added.
Administrator privileges are not required.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
12 months agoamdgcn: remove unnecessary scalar cache flush
Andrew Stubbs [Fri, 20 Oct 2023 11:54:17 +0000 (12:54 +0100)]
amdgcn: remove unnecessary scalar cache flush

The exit code isn't actually written via the scalar cache so the cache flush
is not actually needed.

12 months agoCygwin: let feraiseexcept actually raise an exception
Corinna Vinschen [Tue, 31 Oct 2023 12:07:36 +0000 (13:07 +0100)]
Cygwin: let feraiseexcept actually raise an exception

The exception handling inside of Cygwin functions marked as SIGFE
covers exceptions and lets the library code handle them gracefully.
If these functions want to raise an exception, they have to send a
signal explicitely via raise(3).

That's not what we want in feraiseexcept(). It triggers a floating
point exception explicitely by calling the i387 op "fwait".  Being
marked as SIGFE, this exception will be suppressed and the normal
exception handling won't kick in.

Fix this by moving feraiseexcept into the NOSIGFE realm.

Fixes: 0f81b5d4bcaa ("* Makefile.in (DLL_OFILES): Add new fenv.o module.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
12 months agoCygwin: cwd: avoid releasing the cwdstuff SRW Lock twice
Corinna Vinschen [Mon, 30 Oct 2023 18:40:31 +0000 (19:40 +0100)]
Cygwin: cwd: avoid releasing the cwdstuff SRW Lock twice

cwdstuff::set has a code snippet handling the case where a process
can't create a handle to a directory, e. g., due to permissions.

Commit 88443b0a22589 ("cwdstuff: Don't leave from setting the CWD
prematurely on init") introduced a special case to handle this
situation at process initialization. It also introduces an early
mutex release, which is not required, but ok, because we're in the
init phase. Releasing the mutex twice is no problem since the mutexes
are recursive.

Fast forward to commit 0819679a7a210 ("Cygwin: cwd: use SRWLOCK
instead of muto"). The mechanical change from a recursive mutex
to a non-recursive SRWLOCK failed to notice that this very specific
situation will release the SRWLOCK twice.

Remove the superfluous release action. While at it, don't set dir to
NULL, but h, since dir will get the value of h anyway later on.
Setting h to NULL may not be necessary, but better safe than sorry.

Reported-by: tryandbuy >tryandbuy@proton.me>
Fixes: 88443b0a22589 ("cwdstuff: Don't leave from setting the CWD prematurely on init")
Fixes: 0819679a7a210 ("Cygwin: cwd: use SRWLOCK instead of muto")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
12 months agoCygwin: dsp: Improve minimum buffser size estimation.
Takashi Yano [Thu, 5 Oct 2023 12:52:59 +0000 (21:52 +0900)]
Cygwin: dsp: Improve minimum buffser size estimation.

The commit 322c7150b25e restricts buffer size with a fixed length,
however, the minimum buffer size should be varied by the sample rate.
With this patch, it is estimated using sample rate, sample width
and number of channels so that the buffer length is not less than
80 msec which is almost the minimum value of Win MME to work.

Fixes: 322c7150b25e ("Cygwin: dsp: Avoid setting buffer that is too small.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
12 months agonewlib: fix AC_DEFINE quoting style with version macros
Mike Frysinger [Sun, 15 Oct 2023 09:25:52 +0000 (15:10 +0545)]
newlib: fix AC_DEFINE quoting style with version macros

configure.ac files use [] for quoting by default, not "", which
means the "" are passed through as literals.  We don't want that
for these comments, so change the "..." to [...].

12 months agosparc: Improve setjmp()
Sebastian Huber [Fri, 6 Oct 2023 05:29:05 +0000 (07:29 +0200)]
sparc: Improve setjmp()

Flush the windows in setjmp().  This helps if the stack is changed after
the setjmp() and we want to jump back to the original stack using
longjmp().

12 months agoriscv: Fix fenv.h support
Sebastian Huber [Thu, 12 Oct 2023 09:59:32 +0000 (11:59 +0200)]
riscv: Fix fenv.h support

Use the same C preprocessor expressions to define FE_RMODE_MASK and
__RISCV_HARD_FLOAT.

The problem was noticed on GCC 10 which does not define __riscv_f.

12 months agoDelete check in catan, catanf, and catanl functions.
Joseph Faulls [Tue, 10 Oct 2023 19:12:00 +0000 (15:12 -0400)]
Delete check in catan, catanf, and catanl functions.

The check incorrectly results in catan returning nan + inf i when real part is +/- 1 and
imaginary part is 0.  The same occurs for real 0.8 and imaginary 0.6.

The change ends up matching glibc behaviour.

12 months agoaarch64: Import memrchr.S
Sebastian Huber [Tue, 12 Sep 2023 08:33:14 +0000 (10:33 +0200)]
aarch64: Import memrchr.S

Import memrchr.S for AArch64 from:

https://github.com/ARM-software/optimized-routines

commit 0cf84f26b6b8dcad8287fe30a4dcc1fdabd06560
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Thu Jul 27 17:14:57 2023 +0200

    string: Fix corrupt GNU_PROPERTY_TYPE (5) size

    For ELF32 the notes alignment is 4 and not 8.

12 months agoaarch64: Sync with ARM-software/optimized-routines
Sebastian Huber [Tue, 12 Sep 2023 08:33:09 +0000 (10:33 +0200)]
aarch64: Sync with ARM-software/optimized-routines

Update AArch64 assembly string routines from:

https://github.com/ARM-software/optimized-routines

commit 0cf84f26b6b8dcad8287fe30a4dcc1fdabd06560
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Thu Jul 27 17:14:57 2023 +0200

    string: Fix corrupt GNU_PROPERTY_TYPE (5) size

    For ELF32 the notes alignment is 4 and not 8.

Add license and copyright information to COPYING.NEWLIB as entry (56).

13 months agonewlib: Add missing prototype for _getentropy
Torbjörn SVENSSON [Mon, 25 Sep 2023 18:37:45 +0000 (20:37 +0200)]
newlib: Add missing prototype for _getentropy

13 months agoBring back libsim.a for riscv
Alexey Lapshin [Tue, 19 Sep 2023 02:46:19 +0000 (22:46 -0400)]
Bring back libsim.a for riscv

13 months agonewlib: Fix header install
Alexey Lapshin [Tue, 12 Sep 2023 08:28:34 +0000 (10:28 +0200)]
newlib: Fix header install

13 months agoCygwin: dsp: Avoid setting buffer that is too small.
Takashi Yano [Sat, 16 Sep 2023 23:49:34 +0000 (08:49 +0900)]
Cygwin: dsp: Avoid setting buffer that is too small.

The buffer size that is too small causes choppy sound. That is not
practical at all. With this patch, the minimum value of the buffer
size (i.e. fragstotal * fragsize) is restricted to 16384 bytes.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
13 months agoCygwin: dsp: Fix a bug that app hangs if it killed during write().
Takashi Yano [Sat, 16 Sep 2023 23:32:09 +0000 (08:32 +0900)]
Cygwin: dsp: Fix a bug that app hangs if it killed during write().

If app is killed during blocking write(), it sometimes hangs. This
patch fixes the issue.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
13 months agoReentrancy, attempt to always provide _Thread_local in <sys/reent.h>
Pekka Seppänen [Wed, 30 Aug 2023 09:16:36 +0000 (12:16 +0300)]
Reentrancy, attempt to always provide _Thread_local in <sys/reent.h>

Attempt to always provide _Thread_local in <sys/reent.h> by including
<sys/cdefs.h>.  The C specific keyword _Thread_local is not available
unless targetting a suitable C version.

13 months agoReentrancy, conditionally provide default __getreent() implementation
Pekka Seppänen [Wed, 30 Aug 2023 09:16:32 +0000 (12:16 +0300)]
Reentrancy, conditionally provide default __getreent() implementation

Conditionally provide default __getreent() implementation only if
_REENT_THREAD_LOCAL is not defined.  If struct _reent is replaced by
dedicated thread-local objects neither the structure nor _impure_ptr is
available.

13 months agoReentrancy, use _REENT_ERRNO()
Pekka Seppänen [Wed, 30 Aug 2023 09:16:26 +0000 (12:16 +0300)]
Reentrancy, use _REENT_ERRNO()

Use _REENT_ERRNO() macro to access errno.  This encapsulation is
required, as errno might be either _errno member of struct _reent,
_tls_errno or any such implementation detail.

13 months agoCygwin: Add initial support for SOURCE_DATE_EPOCH
Christian Franke [Tue, 5 Sep 2023 16:32:49 +0000 (18:32 +0200)]
Cygwin: Add initial support for SOURCE_DATE_EPOCH

If specified, set version timestamp to this value.
Enable deterministic archives for ar and ranlib.
Set cygwin1.dll PE and export table header timestamps to zero.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
13 months agoCygwin: NFS: remove recognizing native symlinks as FIFOs
Corinna Vinschen [Sat, 9 Sep 2023 21:26:21 +0000 (23:26 +0200)]
Cygwin: NFS: remove recognizing native symlinks as FIFOs

Given the downsides of NFS symlinks as FIFOs, drop the code
added to recognize them as such.

Fixes: 622fb0776ea3 ("Cygwin: enable usage of FIFOs on NFS")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: NFS: create devices (especially FIFOs) as shortcut files
Corinna Vinschen [Sat, 9 Sep 2023 21:23:52 +0000 (23:23 +0200)]
Cygwin: NFS: create devices (especially FIFOs) as shortcut files

Creating real NFS symlinks for device files has a  major downside:
The way we store device info requires to change the symlink target
in case of calling chmod(2). This falls flat in two ways:

- It requires to remove and recreate the symlink, so it doesn't
  exist for a short period of time, and
- removing fails badly if there's another open handle to the symlink.

Therefore, change this to create FIFOs as shortcut files, just as on
most other filesystems.  Make sure to recognize these new shortcuts
on NFS (for devices only) in path handling and readdir.

Fixes: 622fb0776ea3 ("Cygwin: enable usage of FIFOs on NFS")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: NFS: fetch actual DOS attributes
Corinna Vinschen [Sat, 9 Sep 2023 21:10:43 +0000 (23:10 +0200)]
Cygwin: NFS: fetch actual DOS attributes

MSFT NFSv3 fakes DOS attributes based on file type and permissions.
Rather than just faking FILE_ATTRIBUTE_DIRECTORY for dirs, fetch the
"real" DOS attributes returned by NFS.

This allows to handle the "R/O" attribute on shortcut files and thus
reading and creating device shortcut files on NFS.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: readdir: explain why we use FileNamesInformation on NFS
Corinna Vinschen [Sat, 9 Sep 2023 21:05:29 +0000 (23:05 +0200)]
Cygwin: readdir: explain why we use FileNamesInformation on NFS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: Add relnote to 3.4.10 release file
Mark Geisert [Sat, 9 Sep 2023 06:48:30 +0000 (23:48 -0700)]
Cygwin: Add relnote to 3.4.10 release file

Document the most recent update to include/sys/cpuset.h.

13 months agoCygwin: Fix __cpuset_zero_s prototype
Mark Geisert [Fri, 8 Sep 2023 05:36:39 +0000 (22:36 -0700)]
Cygwin: Fix __cpuset_zero_s prototype

Add a missing "void" to the prototype for __cpuset_zero_s().

Reported-by: Marco Mason <marco.mason@gmail.com>
Addresses: https://cygwin.com/pipermail/cygwin/2023-September/254423.html
Signed-off-by: Mark Geisert <mark@maxrnd.com>
Fixes: c6cfc99648d6 (Cygwin: sys/cpuset.h: add cpuset-specific external functions)
13 months agoCygwin: fix an ugly cast
Corinna Vinschen [Fri, 8 Sep 2023 20:41:21 +0000 (22:41 +0200)]
Cygwin: fix an ugly cast

fhandler_base::fchown casts any fhandler landing here to a
fhandler_disk_file.  That's ugly and dangerous.  Duplicate
the path_conv info into an explicitly create fhandler_disk_file
instead and call fchmod on that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: fix chmod on native NFS FIFOs
Corinna Vinschen [Fri, 8 Sep 2023 20:38:53 +0000 (22:38 +0200)]
Cygwin: fix chmod on native NFS FIFOs

By handling native NFS FIFOs as actual FIFOs, chmod on a FIFO
suddenly called fhandler_base::fchmod, which is insufficient
to handle FIFO files on any filesystem.

Note that this does not fix Cygwin FIFOs on NFS or AFS yet.

Fixes: 622fb0776ea3 ("Cygwin: enable usage of FIFOs on NFS")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: unlink_nt: declare in winsup.h
Corinna Vinschen [Fri, 8 Sep 2023 20:34:52 +0000 (22:34 +0200)]
Cygwin: unlink_nt: declare in winsup.h

unlink_nt is used more than once so declare it in a header.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: dsp: Improve response time of select()/poll().
Takashi Yano [Thu, 7 Sep 2023 08:35:25 +0000 (17:35 +0900)]
Cygwin: dsp: Improve response time of select()/poll().

With this patch, the response time of select()/poll() has been
improved by utilizing semaphore (select_sem) just like pipe and
fifo. In addition, notification of exceptional conditions has
been added.

Fixes: 2c06014f12b0 ("Cygwin: dsp: Implement select()/poll().")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
13 months agoCygwin: dsp: Implement select()/poll().
Takashi Yano [Wed, 6 Sep 2023 13:03:18 +0000 (22:03 +0900)]
Cygwin: dsp: Implement select()/poll().

Previously, sound device /dev/dsp did not support select()/poll().
These have been implemented with this patch.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
13 months agoCygwin: dsp: Fix trivial editorial issue.
Takashi Yano [Tue, 5 Sep 2023 08:12:59 +0000 (17:12 +0900)]
Cygwin: dsp: Fix trivial editorial issue.

13 months agoCygwin: dsp: Reduce wait time for blocking read().
Takashi Yano [Tue, 5 Sep 2023 08:11:13 +0000 (17:11 +0900)]
Cygwin: dsp: Reduce wait time for blocking read().

Previous wait time of 100msec is too long if application specifies
smaller buffer. With this patch, the wait time is reduced to 1msec.

13 months agoCygwin: dps: Fix a bug that read() could not return -1 on error.
Takashi Yano [Tue, 5 Sep 2023 07:59:51 +0000 (16:59 +0900)]
Cygwin: dps: Fix a bug that read() could not return -1 on error.

13 months agoCygwin: document FIFO over NFS change
Corinna Vinschen [Sat, 26 Aug 2023 14:59:18 +0000 (16:59 +0200)]
Cygwin: document FIFO over NFS change

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoRevert "Cygwin: mknod: disable creating special files on NFS"
Corinna Vinschen [Sat, 26 Aug 2023 13:42:33 +0000 (15:42 +0200)]
Revert "Cygwin: mknod: disable creating special files on NFS"

This reverts commit d085592daa5f89ccc9f5b86b2ca26199e7516d61.

This reenables creating Cygwin FIFOs on NFS.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: enable usage of FIFOs on NFS
Corinna Vinschen [Sat, 26 Aug 2023 13:41:18 +0000 (15:41 +0200)]
Cygwin: enable usage of FIFOs on NFS

FIFOs on NFS were never recogized as such in path handling.

stat(2) indicated native FIFOs as FIFOs but the path handling
code didn't set the matching values in the inner symlink checking
code, so the followup behaviour was wrong.

Basically for the same reason, Cygwin-created FIFOs were just treated
as symlinks with weird content by stat(2) as well as path handling.

Add code to enable both types of FIFOs on NFS as Cygwin FIFOs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
13 months agoCygwin: CI: Also deploy documentation for release tags
Jon Turney [Thu, 31 Aug 2023 19:21:56 +0000 (20:21 +0100)]
Cygwin: CI: Also deploy documentation for release tags

13 months agoCygwin: CI: Add documentation preview deploy step
Jon Turney [Thu, 10 Aug 2023 13:51:37 +0000 (14:51 +0100)]
Cygwin: CI: Add documentation preview deploy step

13 months agoCygwin: CI: Simplify and reduce the number of steps in cross-build job
Jon Turney [Sat, 22 Jul 2023 13:00:17 +0000 (14:00 +0100)]
Cygwin: CI: Simplify and reduce the number of steps in cross-build job

14 months agoCygwin: CI: Take note of the testsuite status
Jon Turney [Sat, 22 Jul 2023 20:04:28 +0000 (21:04 +0100)]
Cygwin: CI: Take note of the testsuite status

14 months agoCygwin: cpuinfo: Linux 6.5 additions
Brian Inglis [Fri, 1 Sep 2023 17:42:10 +0000 (11:42 -0600)]
Cygwin: cpuinfo: Linux 6.5 additions

add AMD 0x8000001f EAX 14 debug_swap SEV-ES full debug state swap

Signed-off-by: Brian Inglis <Brian.Inglis@Shaw.ca>
14 months agoCygwin: Implement sound mixer device.
Takashi Yano [Fri, 1 Sep 2023 08:41:10 +0000 (17:41 +0900)]
Cygwin: Implement sound mixer device.

This patch adds implementation of OSS-based sound mixer device. This
allows applications to change the sound playing volume.

NOTE: Currently, the recording volume cannot be changed.

Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
14 months agoCygwin: document latest sys/cpuset.h fix
Corinna Vinschen [Fri, 1 Sep 2023 10:41:43 +0000 (12:41 +0200)]
Cygwin: document latest sys/cpuset.h fix

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: sys/cpuset.h: use internal base types
Corinna Vinschen [Wed, 30 Aug 2023 19:11:42 +0000 (21:11 +0200)]
Cygwin: sys/cpuset.h: use internal base types

Use __size_t and __pid_t instead of size_t and pid_t to avoid
further dependencies to external headers.

Reported-by: Brian Inglis <Brian.Inglis@Shaw.ca>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: sys/cpuset.h: add cpuset-specific external functions
Corinna Vinschen [Wed, 30 Aug 2023 09:32:02 +0000 (11:32 +0200)]
Cygwin: sys/cpuset.h: add cpuset-specific external functions

The latest incarnation of sys/cpuset.h broke building coreutils.
The reason is the inclusion of stdlib.h and string.h and hence
premature requests for datatypes not yet defined in the include
chain.

Avoid this by defining __cpuset_alloc and __cpuset_free as external
functions, now defined in sched.cc.  Linux is doing this too, just
using different names for the functions. Redefine  __cpuset_zero_s
to use __builtin_memset only on compilers supporting it, otherwise
using a simple loop. Drop the stdlib.h and string.h includes.

Fixes: 3f2790e04439 ("Cygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnostic")
Reported-by: Denis Excoffier <cygwin@Denis-Excoffier.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: dsp: Fix a few trivial bugs.
Takashi Yano [Fri, 1 Sep 2023 02:32:51 +0000 (11:32 +0900)]
Cygwin: dsp: Fix a few trivial bugs.

Signed-off-by: Takashi Yano <takashi.yanao@nifty.ne.jp>
14 months agolibc/stdlib/nano-mallocr.c, typo in variable name
Pekka Seppänen [Mon, 28 Aug 2023 11:02:20 +0000 (14:02 +0300)]
libc/stdlib/nano-mallocr.c, typo in variable name

Nano malloc uses `size' in assertation whereas the correct variable would be
`s'.  Given this has existed ever since nano malloc support was added, based
on the context ("returned payload area of desired size does not exceed the
actual allocated chunk") I presume that indeed `s' (user input) and not
`r->size' (computed) shall be used.

14 months agoCygwin: execve: drop argument size limit
Corinna Vinschen [Tue, 29 Aug 2023 09:55:10 +0000 (11:55 +0200)]
Cygwin: execve: drop argument size limit

Before commit 44f73c5a6206 ("Cygwin: Fix segfalt when too many command
line args are specified.") we had no actual argument size limit, except
for the fact that the child process created another copy of the argv
array on the stack, which could result in a stack overflow and a
subsequent SEGV.  Commit 44f73c5a6206 changed that by allocating the
additional argv array via malloc, and it introduced a new SC_ARG_MAX
limit along the lines of the typical Linux limit.

However, this new limit is artificial. Cygwin allocates all argument
and environment data on the cygheap.  We only run out of ARG_MAX space
if we're out of memory resources.

Change argument size handling accordingly:
- Drop the args size check from  child_info_spawn::worker.
- Return -1 from sysconf (SC_ARG_MAX), i. e., the argument size limit
  is undefined.
- Change argv handling in class av, so that a failing cmalloc is not
  fatal.  This allows the parent process to return E2BIG if it's out
  of cygheap resources.
- In the child, add a check around the new malloc call, so that it
  doesn't result in a SEGV if the child process gets unexpectedly into
  an ENOMEM situation at this point. In this (unlikely) case, proceed
  with the original __argv array instead.  Add comment to explain why.

Fixes: 44f73c5a6206 ("Cygwin: Fix segfalt when too many command line args are specified.")
Tested-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agonewlib: fix 'sed' for sys headers path prefix
Alexey Lapshin [Mon, 28 Aug 2023 09:39:12 +0000 (09:39 +0000)]
newlib: fix 'sed' for sys headers path prefix

Precisely remove the prefix from the filepath.

14 months agoCygwin: Fix segfalt when too many command line args are specified.
Takashi Yano [Mon, 28 Aug 2023 13:14:41 +0000 (22:14 +0900)]
Cygwin: Fix segfalt when too many command line args are specified.

Previously, the number of command line args was not checked for
cygwin process. Due to this, segmentation fault was caused if too
many command line args are specified.
https://cygwin.com/pipermail/cygwin/2023-August/254333.html

Since char *argv[argc + 1] is placed on the stack in dll_crt0_1(),
STATUS_STACK_OVERFLOW occurs if the stack does not have enough
space.

With this patch, char *argv[] is placed in heap instead of stack
and ARG_MAX is increased from 32000 to 2097152 which is default
value of Linux. The argument length is also compared with ARG_MAX
and spawnve() returns E2BIG if it is too long.

Reported-by: Ed Morton
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This page took 0.071817 seconds and 5 git commands to generate.