Commit Graph

21553 Commits

Author SHA1 Message Date
Christian Franke 1ebef73c59 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>
2023-11-07 13:12:04 +01:00
Christian Franke c8cf1933ba 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>
2023-11-05 17:01:43 +01:00
Andrew Stubbs 12e3bac3ce 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.
2023-10-31 13:36:45 +01:00
Corinna Vinschen 2ef627c46e 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: 0f81b5d4bc ("* Makefile.in (DLL_OFILES): Add new fenv.o module.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-10-31 13:27:51 +01:00
Corinna Vinschen 60d1eeac6c 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 88443b0a22 ("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 0819679a7a ("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: 88443b0a22 ("cwdstuff: Don't leave from setting the CWD prematurely on init")
Fixes: 0819679a7a ("Cygwin: cwd: use SRWLOCK instead of muto")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-10-30 19:40:31 +01:00
Takashi Yano d56d58ace2 Cygwin: dsp: Improve minimum buffser size estimation.
The commit 322c7150b2 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: 322c7150b2 ("Cygwin: dsp: Avoid setting buffer that is too small.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-10-30 19:58:38 +09:00
Mike Frysinger 39f734a857 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 [...].
2023-10-15 15:10:52 +05:45
Sebastian Huber fbc5496e40 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().
2023-10-12 17:04:38 +02:00
Sebastian Huber 696c282cf3 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.
2023-10-12 16:46:21 +02:00
Joseph Faulls dcb2b7d7b8 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.
2023-10-10 15:18:54 -04:00
Sebastian Huber fe5886a500 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.
2023-10-05 14:16:59 +02:00
Sebastian Huber 96ec8f868e 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).
2023-10-05 14:16:57 +02:00
Torbjörn SVENSSON a9e8e3d1cb newlib: Add missing prototype for _getentropy 2023-09-25 18:20:25 -04:00
Alexey Lapshin 55485616ba Bring back libsim.a for riscv 2023-09-18 22:49:15 -04:00
Alexey Lapshin 6e5676a915 newlib: Fix header install 2023-09-18 18:45:34 +02:00
Takashi Yano 322c7150b2 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>
2023-09-17 21:54:11 +09:00
Takashi Yano 8484773f47 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>
2023-09-17 21:53:44 +09:00
Pekka Seppänen c2d2bf34e6 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.
2023-09-11 09:23:05 +02:00
Pekka Seppänen 7a1c717c8b 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.
2023-09-11 09:23:05 +02:00
Pekka Seppänen 766f1beb4d 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.
2023-09-11 09:23:05 +02:00
Christian Franke f5e37b93a0
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>
2023-09-10 14:42:21 +01:00
Corinna Vinschen 5bbe0e56c6 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: 622fb0776e ("Cygwin: enable usage of FIFOs on NFS")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-09 23:28:55 +02:00
Corinna Vinschen c0aa6ac30e 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: 622fb0776e ("Cygwin: enable usage of FIFOs on NFS")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-09 23:28:55 +02:00
Corinna Vinschen 8a953be5ef 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>
2023-09-09 23:28:55 +02:00
Corinna Vinschen 5302638f77 Cygwin: readdir: explain why we use FileNamesInformation on NFS
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-09 23:28:55 +02:00
Mark Geisert 27e8815535 Cygwin: Add relnote to 3.4.10 release file
Document the most recent update to include/sys/cpuset.h.
2023-09-09 23:28:55 +02:00
Mark Geisert 003fc33942 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)
2023-09-09 23:28:55 +02:00
Corinna Vinschen c5913771a6 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>
2023-09-08 22:41:21 +02:00
Corinna Vinschen bedefff9e2 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: 622fb0776e ("Cygwin: enable usage of FIFOs on NFS")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-08 22:38:53 +02:00
Corinna Vinschen 53472e1803 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>
2023-09-08 22:34:52 +02:00
Takashi Yano 7ced682549 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: 2c06014f12 ("Cygwin: dsp: Implement select()/poll().")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-09-07 17:36:04 +09:00
Takashi Yano 2c06014f12 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>
2023-09-06 22:06:57 +09:00
Takashi Yano 7a43763d24 Cygwin: dsp: Fix trivial editorial issue. 2023-09-05 18:28:01 +09:00
Takashi Yano 8b2b54b41d 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.
2023-09-05 18:28:01 +09:00
Takashi Yano 2654a5ba76 Cygwin: dps: Fix a bug that read() could not return -1 on error. 2023-09-05 18:28:01 +09:00
Corinna Vinschen 2ab2e73c2c Cygwin: document FIFO over NFS change
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-04 10:41:06 +02:00
Corinna Vinschen 46e986f0e4 Revert "Cygwin: mknod: disable creating special files on NFS"
This reverts commit d085592daa.

This reenables creating Cygwin FIFOs on NFS.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-04 10:41:06 +02:00
Corinna Vinschen 622fb0776e 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>
2023-09-04 10:41:02 +02:00
Jon Turney 24b029ba8e
Cygwin: CI: Also deploy documentation for release tags 2023-09-03 14:57:53 +01:00
Jon Turney 352f051cf9
Cygwin: CI: Add documentation preview deploy step 2023-09-03 14:57:52 +01:00
Jon Turney e94d3e168b
Cygwin: CI: Simplify and reduce the number of steps in cross-build job 2023-09-03 14:57:36 +01:00
Jon Turney 1db6fb03e7
Cygwin: CI: Take note of the testsuite status 2023-09-02 16:55:42 +01:00
Brian Inglis c4aa56bbf2 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>
2023-09-01 20:40:54 +02:00
Takashi Yano 2a4af36614 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>
2023-09-01 21:33:38 +09:00
Corinna Vinschen 3daedf267d Cygwin: document latest sys/cpuset.h fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-01 12:42:10 +02:00
Corinna Vinschen ac4699fdf3 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>
2023-09-01 12:38:52 +02:00
Corinna Vinschen d27e9fb29a 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: 3f2790e044 ("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>
2023-09-01 12:38:52 +02:00
Takashi Yano cc4ff714ff Cygwin: dsp: Fix a few trivial bugs.
Signed-off-by: Takashi Yano <takashi.yanao@nifty.ne.jp>
2023-09-01 11:32:51 +09:00
Pekka Seppänen 31eb43efa7 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.
2023-08-29 14:33:27 +02:00
Corinna Vinschen ca2a4ec243 Cygwin: execve: drop argument size limit
Before commit 44f73c5a62 ("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 44f73c5a62 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: 44f73c5a62 ("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>
2023-08-29 14:17:04 +02:00