]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
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>
14 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

14 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

14 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>
14 months agoCygwin: termios: Refactor the function is_console_app().
Takashi Yano [Mon, 28 Aug 2023 08:38:52 +0000 (17:38 +0900)]
Cygwin: termios: Refactor the function is_console_app().

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
14 months agoRevert "Cygwin: autoload: introduce LoadDLLfunc_pfx_only"
Corinna Vinschen [Sat, 26 Aug 2023 16:00:04 +0000 (18:00 +0200)]
Revert "Cygwin: autoload: introduce LoadDLLfunc_pfx_only"

This reverts commit 0e711d6cc9b5206335fe8562817b6d5e6cad876e.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoRevert "Cygwin: select: workaround FD_WRITE network event handling"
Corinna Vinschen [Sat, 26 Aug 2023 15:59:58 +0000 (17:59 +0200)]
Revert "Cygwin: select: workaround FD_WRITE network event handling"

This reverts commit dedbbd74d0a8f3b7dfae6188321703a47bb8a2b3.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: document disabling mknod/mkfifo on NFS
Corinna Vinschen [Fri, 25 Aug 2023 12:50:48 +0000 (14:50 +0200)]
Cygwin: document disabling mknod/mkfifo on NFS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: mknod: disable creating special files on NFS
Corinna Vinschen [Fri, 25 Aug 2023 12:39:04 +0000 (14:39 +0200)]
Cygwin: mknod: disable creating special files on NFS

This simply doesn't work (yet?) but leaves unusable files behind.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: doc: add new API calls in 3.5
Corinna Vinschen [Fri, 25 Aug 2023 09:11:32 +0000 (11:11 +0200)]
Cygwin: doc: add new API calls in 3.5

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agolibgloss: add Xtensa port
Alexey Lapshin [Tue, 8 Aug 2023 20:07:04 +0000 (00:07 +0400)]
libgloss: add Xtensa port

Supported esp32 and esp32s2 boards:
https://github.com/espressif/esp-toolchain-docs/blob/main/gcc/build-and-run-native-app.md

14 months agoCygwin: pty: Fix failure to clear switch_to_nat_pipe flag.
Takashi Yano [Sat, 19 Aug 2023 05:10:16 +0000 (14:10 +0900)]
Cygwin: pty: Fix failure to clear switch_to_nat_pipe flag.

After the commit fbfea31dd9b9, switch_to_nat_pipe is not cleared
properly when non-cygwin app is terminated in the case where the
pseudo console is disabled. This is because get_winpid_to_hand_over()
sometimes returns PID of cygwin process even though it should return
only PID of non-cygwin process. This patch fixes the issue by adding
a new argument which requests only PID of non-cygwin process to
get_console_process_id().

Fixes: fbfea31dd9b9 ("Cygwin: pty: Avoid cutting the branch the pty master is sitting on.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
14 months agonewlib: add Xtensa port
Alexey Lapshin [Wed, 16 Aug 2023 22:05:53 +0000 (02:05 +0400)]
newlib: add Xtensa port

14 months agoCygwin: shared: Fix access permissions setting in open_shared().
Takashi Yano [Tue, 15 Aug 2023 23:00:27 +0000 (08:00 +0900)]
Cygwin: shared: Fix access permissions setting in open_shared().

After the commit 93508e5bb841, the access permissions argument passed
to open_shared() is ignored and always replaced with (FILE_MAP_READ |
FILE_MAP_WRITE). This causes the weird behaviour that sshd service
process loses its cygwin PID. This triggers the failure in pty that
transfer_input() does not work properly.

This patch resumes the access permission settings to fix that.

Fixes: 93508e5bb841 ("Cygwin: open_shared: don't reuse shared_locations parameter as output")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signedd-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
14 months agoCygwin: pty: Add missing pinfo check in transfer_input().
Takashi Yano [Mon, 14 Aug 2023 10:48:12 +0000 (19:48 +0900)]
Cygwin: pty: Add missing pinfo check in transfer_input().

The commit 10d083c745dd has a bug that lacks a check for pinfo pointer
value for master_pid. This causes segmentation fault if the process
whose pid is master_pid no longer exists. This patch fixes the issue.

Fixes: 10d083c745dd ("Cygwin: pty: Inherit typeahead data between two input pipes.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
14 months agoCygwin: cXXrtomb, mbrtcXX: use function-specific internal state
Corinna Vinschen [Tue, 15 Aug 2023 20:34:29 +0000 (22:34 +0200)]
Cygwin: cXXrtomb, mbrtcXX: use function-specific internal state

As described in the previous commit b5111e46424b
("struct _reent: add state for unicode functions") every unicode
conversion function has to use their own state object, if the
state parameter is NULL.

Fixes: 4f258c55e87f ("Cygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32.")
Fixes: c49bc478b4a7 ("Cygwin: Add ISO C2X functions c8rtomb, mbrtoc8")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agostruct _reent: add state for unicode functions
Corinna Vinschen [Tue, 15 Aug 2023 20:30:59 +0000 (22:30 +0200)]
struct _reent: add state for unicode functions

C23 requires that the unicode functions c16rtomb, c8rtomb, mbrtoc16,
mbrtoc32 and mbrtoc8 use their own internal state object.  c32rtomb
only needs an internal state if the lib supports encoding with
shift states, but that's the case for newlib and Cygwin.

Only Cygwin implements these functions so add the states
objects only for Cygwin for now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: testsuite: Tweak lseek03 after addition of SEEK_HOLE
Jon Turney [Thu, 10 Aug 2023 19:50:00 +0000 (20:50 +0100)]
Cygwin: testsuite: Tweak lseek03 after addition of SEEK_HOLE

After addition of SEEK_HOLE, the whence of *4* is not an invalid
argument, causing the test to FAIL.

See ltp commit  423e636a4c8f ("lseek03: change to fix with the lseek syscall")

14 months agoCygwin: testsuite: Add a small delay in kill01
Jon Turney [Tue, 8 Aug 2023 15:38:20 +0000 (16:38 +0100)]
Cygwin: testsuite: Add a small delay in kill01

Avoid transient failures by adding a small delay after fork()-ing to
allow the child to get into a state where it can recieve signals.

Also add same small delay to kill03 and kill04. kill02 has a more
elaborate setup where child processes write to a pipe to indicate they
have started.

14 months agoAdd wildcard support to recurse into sys include directories
Alexey Lapshin [Thu, 10 Aug 2023 18:13:11 +0000 (14:13 -0400)]
Add wildcard support to recurse into sys include directories

14 months agoCygwin: fhandler_base::lseek: fix formatting
Corinna Vinschen [Wed, 9 Aug 2023 16:08:16 +0000 (18:08 +0200)]
Cygwin: fhandler_base::lseek: fix formatting

Fixes: edfa581d3c5a ("Cygwin: lseek: implement SEEK_DATA and SEEK_HOLE for files")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: add SEEK_DATA/SEEK_HOLE addition to release message
Corinna Vinschen [Wed, 9 Aug 2023 15:21:54 +0000 (17:21 +0200)]
Cygwin: add SEEK_DATA/SEEK_HOLE addition to release message

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: lseek: implement SEEK_DATA and SEEK_HOLE for files
Corinna Vinschen [Wed, 9 Aug 2023 15:18:14 +0000 (17:18 +0200)]
Cygwin: lseek: implement SEEK_DATA and SEEK_HOLE for files

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: lseek: propagate new SEEK_DATA and SEEK_HOLE to fhandler
Corinna Vinschen [Wed, 9 Aug 2023 14:56:40 +0000 (16:56 +0200)]
Cygwin: lseek: propagate new SEEK_DATA and SEEK_HOLE to fhandler

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoCygwin: clipboard: Only SEEK_SET and SEEK_CUR are supported
Corinna Vinschen [Wed, 9 Aug 2023 14:56:02 +0000 (16:56 +0200)]
Cygwin: clipboard: Only SEEK_SET and SEEK_CUR are supported

Make sure of that, especially given the addition of
SEEK_DATA and SEEK_HOLE.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agosys/unistd.h: define GNU extensions SEEK_DATA and SEEK_HOLE
Corinna Vinschen [Wed, 9 Aug 2023 14:51:57 +0000 (16:51 +0200)]
sys/unistd.h: define GNU extensions SEEK_DATA and SEEK_HOLE

SEEK_DATA and SEEK_HOLE are GNU nonstandard extensions also present
in Solaris, FreeBSD, and DragonFly BSD; they are proposed for inclusion
in the next POSIX revision (Issue 8).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agoAdd stub for getentropy
Torbjörn SVENSSON [Tue, 8 Aug 2023 16:09:50 +0000 (18:09 +0200)]
Add stub for getentropy

Example test case that fails with undefined reference to getentropy:

Testing g++.robertl/eb77.C,  -std=c++20
doing compile
Executing on host: /build/gcc-13-2709-g9ac9fde961f/bin/arm-none-eabi-g++  /build/src/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eb77.C  -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -fdiagnostics-plain-output   -fmessage-length=0  -std=c++20 -pedantic-errors -Wno-long-long        -Wl,--start-group -lc -lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat   -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,g++_tg.o -lm -o ./eb77.exe    (timeout = 800)
spawn -ignore SIGHUP /build/gcc-13-2709-g9ac9fde961f/bin/arm-none-eabi-g++ /build/src/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eb77.C -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -fdiagnostics-plain-output -fmessage-length=0 -std=c++20 -pedantic-errors -Wno-long-long -Wl,--start-group -lc -lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,g++_tg.o -lm -o ./eb77.exe
pid is 28414 -28414
/build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)':
(.text._ZNSt12_GLOBAL__N_117__libc_getentropyEPv+0x8): undefined reference to `getentropy'
/build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
(.text._ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58): undefined reference to `getentropy'
/build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(libc_a-arc4random.o): in function `_rs_stir':
(.text._rs_stir+0x8): undefined reference to `getentropy'
collect2: error: ld returned 1 exit status
pid is -1
close result is 28414 exp6 0 1
output is /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)':
(.text._ZNSt12_GLOBAL__N_117__libc_getentropyEPv+0x8): undefined reference to `getentropy'
/build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
(.text._ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58): undefined reference to `getentropy'
/build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(libc_a-arc4random.o): in function `_rs_stir':
(.text._rs_stir+0x8): undefined reference to `getentropy'
collect2: error: ld returned 1 exit status
 status 1
compiler exited with status 1
FAIL: g++.old-deja/g++.robertl/eb77.C  -std=c++20 (test for excess errors)
Excess errors:
(.text._ZNSt12_GLOBAL__N_117__libc_getentropyEPv+0x8): undefined reference to `getentropy'
(.text._ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58): undefined reference to `getentropy'
(.text._rs_stir+0x8): undefined reference to `getentropy'
UNRESOLVED: g++.old-deja/g++.robertl/eb77.C  -std=c++20 compilation failed to produce executable

Contributed by STMicroelectronics

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
14 months agoCygwin: CI: XFAIL umask03
Jon Turney [Tue, 1 Aug 2023 14:34:28 +0000 (15:34 +0100)]
Cygwin: CI: XFAIL umask03

umask03 fails in CI due to some not understood weirdness.

14 months agoCygwin: testsuite: Fix cygload test
Jon Turney [Sat, 22 Jul 2023 19:54:49 +0000 (20:54 +0100)]
Cygwin: testsuite: Fix cygload test

Use cygrun to isolate the cygload test from the current DLL, which
allows it to pass.

14 months agoCygwin: testsuite: Update README
Jon Turney [Mon, 10 Jul 2023 15:37:41 +0000 (16:37 +0100)]
Cygwin: testsuite: Update README

v2:
Polish instructions on adding a test

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
14 months agoCygwin: testsuite: Add '-notimeout' option to cygrun
Jon Turney [Thu, 20 Jul 2023 12:54:09 +0000 (13:54 +0100)]
Cygwin: testsuite: Add '-notimeout' option to cygrun

Add '-notimeout' option for cygrun.  This is very useful when using it
to run a test standalone and under a debugger.

Also: warn about excess arguments

14 months agoCygwin: fix build failure due to redefinition of __restrict in sys/cdefs.h
Corinna Vinschen [Mon, 7 Aug 2023 14:04:32 +0000 (16:04 +0200)]
Cygwin: fix build failure due to redefinition of __restrict in sys/cdefs.h

Commit 3c75fac130b5 fixed the __restrict definition in sys/cdefs.h,
but uncovered a problem in the definition of lio_listio in Cygwin's
aio.h.  It uses the C99 extension of using the restrict keyword
to define non-overlapping arrays. However, this is not allowed in
C++.

Use the newly defined __restrict_arr from commit e66c63be6b80
("sys/cdefs.h: introduce __restrict_arr, as in glibc")

Fixes: 3c75fac130b5 ("sys/cdefs.h: fix for use __restrict in C++"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agosys/cdefs.h: introduce __restrict_arr, as in glibc
Corinna Vinschen [Mon, 7 Aug 2023 13:59:42 +0000 (15:59 +0200)]
sys/cdefs.h: introduce __restrict_arr, as in glibc

C99 allows to define arrays as non-overlappiung using the restrict
keyword.  This is supported by GCC 3.1 and later, but it's not
allowed in C++.

This is in preparation of fixing a Cygwin build problem introduce by
commit 3c75fac130b5.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
14 months agosys/cdefs.h: fix for use __restrict in C++
Sebastian Huber [Sun, 6 Aug 2023 13:27:27 +0000 (16:27 +0300)]
sys/cdefs.h: fix for use __restrict in C++

Newlib shares large parts of <sys/cdefs.h> with FreeBSD and received
this bug report:

https://sourceware.org/pipermail/newlib/2023/020400.html

As an extension, GCC and clang offer C99-style restricted pointers in
C++ mode:
https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html

We notice that this extension is broken when including newlib headers:
restricted pointers are treated as ordinary pointers.

We traced this to the following section of
newlib/libc/include/sys/cdefs.h:

  /*
   * GCC 2.95 provides `__restrict' as an extension to C90 to support the
   * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
   * a way to define the `restrict' type qualifier without disturbing older
   * software that is unaware of C99 keywords.
   */
  #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
  #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
  #define __restrict
  #else
  #define __restrict restrict
  #endif
  #endif

While the GCC __restrict extension was indeed introduced in GCC 2.95, it
is not limited to this version; the extension is also not limited to
C90:
https://gcc.gnu.org/gcc-2.95/c++features.html

Rewrite the logic in the header so that __restrict is kept alone when
available.

PR: 272723
MFC after: 1 week

14 months ago<sys/cdefs.h>: Decay expression passed to fallback
John Baldwin [Fri, 27 Jan 2023 00:28:22 +0000 (16:28 -0800)]
<sys/cdefs.h>: Decay expression passed to fallback

version of __generic()

This ensures that __generic() more closely matches _Generic() when
using the fallback version when _Generic() is not available (such as
GCC).

Co-authored by: jrtc27
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D38215

14 months agoCygwin: pty: Fix thread safety of readahead buffer handling in pty master.
Takashi Yano [Fri, 4 Aug 2023 08:45:34 +0000 (17:45 +0900)]
Cygwin: pty: Fix thread safety of readahead buffer handling in pty master.

Previously, though readahead buffer handling in pty master was not
fully thread-safe, accept_input() was called from peek_pipe() thread
in select.cc. This caused the problem reported in:
https://cygwin.com/pipermail/cygwin/2023-July/253984.html

The mechanism of the problem is:
1) accept_input() which is called from peek_pipe() thread calls
   eat_readahead(-1) before reading readahead buffer. This allows
   writing to the readahead buffer from another (main) thread.
2) The main thread calls fhandler_pty_master::write() just after
   eat_readahead(-1) was called and before reading the readahead
   buffer by accept_input() called from peek_pipe() thread. This
   overwrites the readahead buffer.
3) The read result from readahead buffer which was overwritten is
   sent to the slave.

This patch makes readahead buffer handling fully thread-safe using
input_mutex to resolve this issue.

Fixes: 7b03b0d8cee0 ("select.cc (peek_pipe): Call flush_to_slave whenever we're checking for a pty master.")
Reported-by: Thomas Wolff <towo@towo.net>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
14 months agonewlib: gdtoa: Suppress compiler warning.
Takashi Yano [Fri, 4 Aug 2023 08:42:18 +0000 (17:42 +0900)]
newlib: gdtoa: Suppress compiler warning.

Fixes: 5ac83ea47a7a ("newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
15 months agoCygwin: CI: don't run on both main and master refs
Jon Turney [Sat, 22 Jul 2023 16:47:02 +0000 (17:47 +0100)]
Cygwin: CI: don't run on both main and master refs

15 months agoCygwin: Add ISO C2X functions c8rtomb, mbrtoc8
Corinna Vinschen [Wed, 2 Aug 2023 14:55:52 +0000 (16:55 +0200)]
Cygwin: Add ISO C2X functions c8rtomb, mbrtoc8

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agosys/features.h: Define _ISOC2X_SOURCE and __ISO_C_VISIBLE
Corinna Vinschen [Wed, 2 Aug 2023 14:52:27 +0000 (16:52 +0200)]
sys/features.h: Define _ISOC2X_SOURCE and __ISO_C_VISIBLE

Add feature test for C2X code. Add matching definitions
_ISOC2X_SOURCE for requesting sources and __ISO_C_VISIBLE
to be used in headers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: uchar.h: fix definition of uchar16_t and uchar32_t
Corinna Vinschen [Wed, 2 Aug 2023 14:50:23 +0000 (16:50 +0200)]
Cygwin: uchar.h: fix definition of uchar16_t and uchar32_t

Per C++11, uchar16_t and uchar32_t are defined the same as
uint_least16_t and uint_least32_t.  Also, check for the C++
version to make sure that the types are not colliding with
predefined c++ types.

Fixes: 4f258c55e87f ("Cygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agonewlib: Fix memory leak regarding gdtoa-based _ldtoa_r().
Takashi Yano [Wed, 2 Aug 2023 05:31:53 +0000 (14:31 +0900)]
newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().

After the commit a4705d387f78, printf() for floating-point values
causes a memory leak. The legacy _ldtoa_r() assumed the char pointer
returned will be free'ed by Bfree(). However, gdtoa-based _ldtoa_r()
returns the pointer returned by gdtoa() which should be free'ed by
freedtoa(). Due to this issue, the caller of _ldtoa_r() fails to free
the allocated char buffer. This is the cause of the said memory leak.
https://cygwin.com/pipermail/cygwin/2023-July/254054.html

This patch makes rv_alloc()/freedtoa() allocate/free the buffer in
a compatible way with legacy _ldtoa_r().

Fixes: a4705d387f78 ("ldtoa: Import gdtoa from OpenBSD.")
Reported-by: natan_b <natan_b@libero.it>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
15 months agoCygwin: select: workaround FD_WRITE network event handling
Corinna Vinschen [Tue, 1 Aug 2023 12:22:55 +0000 (14:22 +0200)]
Cygwin: select: workaround FD_WRITE network event handling

The FD_WRITE event is a false friend.  It indicates ready to write
even if the next send fails with WSAEWOULDBLOCK.  *After* the fact,
FD_WRITE will be cleared until sending is again possible, but that
is too late for a select/write loop.

Workaround that by using the WinSock select function when peeking
at a socket and FD_WRITE gets indicated. WinSock select fortunately
indicates writability correctly.

Fixes: 70e476d27be8 ("(peek_socket): Use event handling for peeking socket.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: autoload: introduce LoadDLLfunc_pfx_only
Corinna Vinschen [Tue, 1 Aug 2023 12:16:40 +0000 (14:16 +0200)]
Cygwin: autoload: introduce LoadDLLfunc_pfx_only

This macro loads and defines a function just as usual, except
that the Windows function is exposed only with the prefix
_win32_.  So Windows select (the immediate victim) is only
exposed as _win32_select.  That allows to autoload the windows
function without collision with a Cygwin function of the same
name.

For a start, only define the most simple macro, setting all
extensions to 0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32.
Corinna Vinschen [Mon, 31 Jul 2023 20:38:28 +0000 (22:38 +0200)]
Cygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32.

Add uchar.h accordingly.

For the c32 functions, use the internal functions wirtomb and mbrtowi
as base, and convert wirtomb and mbrtowi to inline functions calling
the c32 functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: fix GB18030 support
Corinna Vinschen [Fri, 28 Jul 2023 21:33:52 +0000 (23:33 +0200)]
Cygwin: fix GB18030 support

The changes to support GB18030 were insufficient and the underlying
Windows conversion functions just failed. Fix how the Windows functions
are called for GB18030.

Fixes: 5da71b605995 ("Cygwin: add support for GB18030 codeset")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoRevert "* libc/stdlib/mbtowc_r.c (__ascii_mbtowc): Disallow conversion of"
Corinna Vinschen [Mon, 31 Jul 2023 10:44:16 +0000 (12:44 +0200)]
Revert "* libc/stdlib/mbtowc_r.c (__ascii_mbtowc): Disallow conversion of"

This reverts commit 2b77087a48ea56e77fca5aeab478c922f6473d7c.

For some reason lost in time, commit 2b77087a48ea5 introduced
Cygwin-specific code treating single byte characters outside the
portable character set as illegal chars.  However, Cygwin was
always alone with this over-correct behaviour and it leads to
stuff like gnulib replacing functions defined in Cygwin with
their own implementation just due to that.

Revert this change, sans the changes to ChangeLog.

Fixes: 2b77087a48ea ("* libc/stdlib/mbtowc_r.c (__ascii_mbtowc): Disallow conversion of")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: belatedly bump CYGWIN_VERSION_API_MINOR for new posix_spawn funcs
Corinna Vinschen [Mon, 31 Jul 2023 20:23:45 +0000 (22:23 +0200)]
Cygwin: belatedly bump CYGWIN_VERSION_API_MINOR for new posix_spawn funcs

Commit c743751aafa84 ("Cygwin: Export
posix_spawn_file_actions_add{f}chdir_np")
added two new functions but we forgot to bump the API version.
Catch up.

Fixes: c743751aafa84 ("Cygwin: Export posix_spawn_file_actions_add{f}chdir_np")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: fnmatch: fix range comparison in C locale
Corinna Vinschen [Thu, 27 Jul 2023 19:57:49 +0000 (21:57 +0200)]
Cygwin: fnmatch: fix range comparison in C locale

Commit c36064bbd0c5 introduced operating on character pointers
instead of operating on characters, to allow collating symbols.
This patch neglected to change the expression for range
comparison in case we're in the C locale.  Thus it suddenly
compared pointers instead of characters.  Fix that.

Fixes: c36064bbd0c5 ("Cygwin: fnmatch: support collating symbols in [. .] brackets")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoFix rounding results in lrint() & llrint() when close to 0
Jesse Huang via Newlib [Thu, 27 Jul 2023 08:49:41 +0000 (01:49 -0700)]
Fix rounding results in lrint() & llrint() when close to 0

soft-fp should round floating pointer numbers according to the current
rounding mode. However, in the current code of lrint() and llrint(),
there are if statements before the actual rounding computation

      if(j0 < -1)
        return 0;

Where j0 is the exponent of the floating point number.

It means any number having a exponent less than -1
(i.e. interval (-0.5, 0.5)) will be rounded to 0 regardeless of the
rounding mode.

The bug already fixed in glibc in 2006 by moving the check afterwards
the rounding computation, but still persists in newlib.

This patch fixed it in a similar way to glibc
Ref Commit in glibc: 6624dbc07b5a9fb316ed188ef01f65b8eea8b47c

15 months agoRename _NL_CTYPE_OUTDIGITSx_MB/WC to _NL_CTYPE_OUTDIGITx_MB/WC
Corinna Vinschen [Wed, 26 Jul 2023 17:48:34 +0000 (19:48 +0200)]
Rename _NL_CTYPE_OUTDIGITSx_MB/WC to _NL_CTYPE_OUTDIGITx_MB/WC

The extended _NL_foo names were originally designed after their GLibc
counterparts.  However, the OUTDIGIT macros were accidentally defined as
OUTDIGITS, plural.  Fix them.

Fixes: d47d5b850bed ("Extend locale support to maintain wide char values of native strings")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoRISC-V: Support Zfinx/Zdinx extension.
Kito Cheng via Newlib [Wed, 26 Jul 2023 10:03:19 +0000 (18:03 +0800)]
RISC-V: Support Zfinx/Zdinx extension.

Zfinx/Zdinx are new extensions ratified in 2022, it similar to F/D extensions,
support hard float operation for single/double precision, but the difference
between Zfinx/Zdinx and F/D is Zfinx/Zdinx is operating under general purpose
registers rather than dedicated floating-point registers.

This patch improve the hard float support detection for RISC-V port, so
that Zfinx/Zdinx can have better/right performance.

Co-authored-by: Jesse Huang <jesse.huang@sifive.com>
15 months agoCygwin: add AT_EMPTY_PATH fix to release message
Corinna Vinschen [Wed, 12 Jul 2023 11:55:23 +0000 (13:55 +0200)]
Cygwin: add AT_EMPTY_PATH fix to release message

Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: Fix and streamline AT_EMPTY_PATH handling
Corinna Vinschen [Wed, 12 Jul 2023 11:47:49 +0000 (13:47 +0200)]
Cygwin: Fix and streamline AT_EMPTY_PATH handling

The GLIBC extension AT_EMPTY_PATH allows the functions fchownat
and fstatat to operate on dirfd alone, if the given pathname is an
empty string.  This also allows to operate on any file type, not
only directories.

Commit fa84aa4dd2fb4 broke this.  It only allows dirfd to be a
directory in calls to these two functions.

Fix that by handling AT_EMPTY_PATH right in gen_full_path_at.
A valid dirfd and an empty pathname is now a valid combination
and, noticably, this returns a valid path in path_ret.  That
in turn allows to remove the additional path generation code
from the callers.

Fixes: fa84aa4dd2fb ("Cygwin: fix errno values set by readlinkat")
Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: use new _AT_NULL_PATHNAME_ALLOWED flag
Corinna Vinschen [Wed, 12 Jul 2023 11:45:24 +0000 (13:45 +0200)]
Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag

Convert gen_full_path_at to take flag values from the caller, rather
than just a bool indicating that empty paths are allowed.  This is in
preparation of a better AT_EMPTY_PATH handling in a followup patch.

Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoDefine _AT_NULL_PATHNAME_ALLOWED
Corinna Vinschen [Wed, 12 Jul 2023 11:27:04 +0000 (13:27 +0200)]
Define _AT_NULL_PATHNAME_ALLOWED

Cygwin needs an internal flag to allow specifying an empty pathname
in utimesat (GLIBC extension). We define it in _default_fcntl.h to
make sure we never introduce a value collision accidentally.
While at it, define the values as 16 bit hex values.

Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: gen_full_path_at: drop never reached code
Corinna Vinschen [Wed, 12 Jul 2023 11:31:31 +0000 (13:31 +0200)]
Cygwin: gen_full_path_at: drop never reached code

The check if the local variable p is NULL is useless.  The preceeding
code always sets p to a valid pointer, or it crashes if path_ret is
invalid (which would be a bug in Cygwin).

Fixes: c57b57e5c43a ("* cygwin.din: Sort.")
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
15 months agoCygwin: CI: Upgrade checkout actions to avoid deprecation warning
Jon Turney [Sat, 22 Jul 2023 12:23:15 +0000 (13:23 +0100)]
Cygwin: CI: Upgrade checkout actions to avoid deprecation warning

Also: workaround a problem with actions/checkout's post-run step using
Cygwin git but being incompatible with it. (This would be better solved
by cygwin-install-action having a post-run step to unwind it's PATH
changes, but that's not currently possible)

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
15 months agoCygwin: CI: Retain test logs as a build artifact
Jon Turney [Sat, 8 Jul 2023 19:53:54 +0000 (20:53 +0100)]
Cygwin: CI: Retain test logs as a build artifact

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
15 months agoCygwin: testsuite: Drop using DejaGnu to run tests
Jon Turney [Wed, 24 Aug 2022 17:21:18 +0000 (18:21 +0100)]
Cygwin: testsuite: Drop using DejaGnu to run tests

A more sophisticated (and modern) test harness would probably be useful,
but switching to Automake's built-in test harness gets us parallel test
execution, colourization of failures, simplifies matters, seems adequate
for the current testuite, and means we don't need to write any icky Tcl.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This page took 0.189879 seconds and 5 git commands to generate.