aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-06-18posix_spawn: factor out structs to an internal headerJeremy Drake2-44/+55
This will allow Cygwin to examine and handle the posix_spawnattr_t and posix_spawn_file_actions_t arguments itself. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-06-18Cygwin: fix MALLOC_ALIGNMENT already defined in newlib for AArch64Radek Bartoň1-0/+3
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-06-18Cygwin: fix compatibility with GCC 15Radek Bartoň3-7/+7
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-06-18Cygwin: configure: allow configuring winsup for AArch64Radek Bartoň1-0/+2
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-06-18newlib: libc: define _ctype for AArch64 CygwinRadek Bartoň1-9/+0
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-06-17Cygwin: signal: Enable the signal mask earlierTakashi Yano2-3/+16
Currently, _cygtls::sigmask is set in call_signal_handler(), but this is too late to effectively prevent a masked signal from being armed. With this patch, deltamask, which is set in _cygtls::interrupt_setup() in advance, is also checked as well as sigmask to determine if the signal can be armed. Fixes: 0d675c5d7f24 ("* exceptions.cc (interrupt_setup): Don't set signal mask here or races occur with main thread. Set it in sigdelayed instead.") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-06-17Cygwin: signal: Revert _cygtls::inside_kernel() changeTakashi Yano2-4/+4
This patch partially reverts the commit b7097ab39ed0 because it seems to cause issues when longjmp is used within a signal handler. The problem that the commit addressed no longer occurs even if this change is reverted. Fixes: b7097ab39ed0 ("Cygwin: signal: Revive toggling incyg flag in call_signal_handler()") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-06-17Cygwin: signal: Prevent unexpected crash on frequent SIGSEGVTakashi Yano4-1/+45
When the thread is suspended and Rip (instruction pointer) points to an instruction that causes an exception, modifying Rip and calling ResumeThread() may sometimes result in a crash. To prevent this, advance execution by a single instruction by setting the trap flag (TF) before calling ResumeThread() as a workaround. This will trigger either STATUS_SINGLE_STEP or the exception caused by the instruction that Rip originally pointed to. By suspending the targeted thread within exception::handle(), Rip no longer points to the problematic instruction, allowing safe handling of the interrupt. As a result, Rip can be adjusted appropriately, and the thread can resume execution without unexpected crashes. Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258153.html Fixes: 1fd5e000ace5 ("import winsup-2000-02-17 snapshot") Reported-by: Christian Franke <Christian.Franke@t-online.de> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-06-14rtems/include/limits.h: Do not define AIO_LISTIO_MAX or AIO_MAXJoel Sherrill1-4/+6
Per https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/limits.h.html, these limits.h constants should not be defined if the implementation does not have an inherent limit. These are based on available memory for RTEMS.
2025-06-14rtems/../sys/dirent.h: Enable DT_ symbols for POSIX >= 202405LJoel Sherrill1-1/+1
Issue 8 added these symbols which which previously BSD extensions.
2025-06-10Cygwin: Fix compatibility with w32api headers v13Radek Bartoň4-0/+19
2025-06-09Cygwin: CI: grant full control to Administrators on github workspaceJeremy Drake1-1/+4
After inherited permissons were removed, apparently there were no permissions left allowing access, and GHA recently started failing on actions/checkout with EPERM. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-06-09libgloss: Fix invalid prototypePaul Cercueil1-1/+1
The __inln prototype was defined as: extern char * __inln (); In old versions of C, this meant "this function takes an unspecified number of parameters". This seems to have changed, as GCC 14 now considers that the function took zero parameters. As the code called it with one parameter, GCC would then issue an error saying that the incorrect number of parameters was passed. Address this issue by changing the prototype of the __inln function. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2025-06-05Cygwin: Add 3.6.3 release noteJon Turney1-0/+5
(cherry picked from commit 77ece859685a59a692ea910d170d2ba83bcd5de4)
2025-06-04Cygwin: do retrieve AzureAD users' information againJohannes Schindelin1-4/+0
In e04891d67a (Cygwin: fetch_account_from_windows: skip LookupAccountSid for SIDs known to fail, 2025-04-10), several SIDs acquired a shortcut where a potentially expensive `LookupAccountSid()` call is avoided for SIDs that "cannot be resolved". However, as reported by Robert Fensterman (and independently discovered by myself), some of the SIDs that received this special shortcut _do_ get resolved by `LookupAccountSid()` calls: AzureAD users' SIDs. With those SIDs, that newly-introduced shortcut actually does more harm than good because there is no other way to retrieve the desired information, resulting in permission problems. One symptom of this is that `mintty` can no longer access `/dev/ptmx` and simply errors out with "Error: Could not fork child process: There are no available terminals (-1)". Another symptom is that `tmux` is no longer able to create new sessions. Yet another symptom is new files are unintentionally written with restricted permissions (copying an `.exe` file, for example, disallows the copied version to be executed). The most likely reason why AzureAD SIDs were included in above-mentioned commit is that special AzureAD _group_ SIDs are not recognized by `LookupAccountSid()`, as per the code comment for the `azure_grp_sid` variable. It is plausible that this fact was mistaken to extend to all AzureAD SIDs, a notion disproved by the counter example of my personal experience with my own AzureAD user account. Unfortunately, the only way to find out whether `LookupAccountSid()` works with a given AzureAD SID or not is to call that function. To make regular AzureAD user accounts work again, let's just drop the AzureAD part from that special shortcut. My understanding of the other SIDs handled by that shortcut (Capability SIDs, IIS APPPOOL and Samba user/group SIDs) is insufficient to determine whether they, too, can be resolved by `LookupAccountSid()` in some cases (and would therefore equally need to be excluded from that shortcut). At least as far as the Capability SIDs go, I am rather confident from reading the context (the commit's message, as well as the report that led to that commit) that the shortcut is safe, and I could imagine that the same is true for IIS APPPOOL and Samba SIDs. Absent any further insight, I therefore decided to leave the rest of e04891d67a (Cygwin: fetch_account_from_windows: skip LookupAccountSid for SIDs known to fail, 2025-04-10) intact. Reported-by: Robert Fensterman <minnmass@gmail.com> Fixes: e04891d67a (Cygwin: fetch_account_from_windows: skip LookupAccountSid for SIDs known to fail, 2025-04-10) Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2025-06-02RISC-V: strcmp [speed optimized]: optimize mismatch logic for targets with ↵puranikvinit1-63/+94
Zb* extension support Reworks the mismatch handling to use Zbb's ctz/clz instructions for faster byte difference detection, significantly improving performance on Zbb-capable targets. Non-Zbb targets retain the original logic for compatibility. Signed-off-by: puranikvinit <kvp933.vinit@gmail.com> Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
2025-06-02RISC-V: strcmp [speed optimized]: optimize null detect logic for targets ↵puranikvinit1-4/+8
with Zb* extension support Introduces conditional use of the orc.b instruction from the Zbb extension for null byte detection, falling back to the original logic for non-Zbb targets. This reduces cycles in the hot path for supported architectures. Signed-off-by: puranikvinit <kvp933.vinit@gmail.com> Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
2025-06-02RISC-V: strcmp [speed optimized]: use compressed registers wherever possiblepuranikvinit1-4/+4
Replaces temporary registers (t0) with compressed registers (a4) in the null detection loop, reducing instruction count and code size in speed-optimized builds while maintaining identical logic. Signed-off-by: puranikvinit <kvp933.vinit@gmail.com> Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
2025-06-02RISC-V: strcmp: refactor labels for improved readabilitypuranikvinit1-13/+18
Renames labels in strcmp.S to use descriptive .L prefixes (e.g., .Lcompare, .Lreturn_diff) instead of numeric labels (e.g., 1f, 2f). This improves maintainability and aligns with modern assembly conventions without affecting functionality. Signed-off-by: puranikvinit <kvp933.vinit@gmail.com> Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
2025-06-02RISC-V: setjmp: reduce code size for register load/store with Zilsdpuranikvinit1-25/+49
This patch optimizes the RISC-V setjmp implementation in newlib/libc/machine/riscv/setjmp.S for 32-bit targets. It reduces code size by using doubleword store/load instructions (sd/ld) when the Zilsd or Zclsd extensions are available for saving and restoring s0-s11 registers, while preserving the original single-word instructions (REG_S/REG_L) for compatibility with other configurations. Signed-off-by: puranikvinit <kvp933.vinit@gmail.com> Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> RISC-V: setjmp: reduce code size for register load/store with Zilsd
2025-06-02newlib: riscv: Remove undefined behavior in strlen()Eric Salem1-1/+4
Pointer arithmetic overflow is undefined behavior, so use a signed type to avoid it. Signed-off-by: Eric Salem <ericsalem@gmail.com>
2025-06-01Cygwin: doc: Update "building DLLs" sectionJon Turney1-41/+133
This hasn't been substantially revised since (at least) 2004, and doesn't really represent normal usage of modern gcc and binutils.
2025-05-29Cygwin: CI: Add stc regression test jobJon Turney1-5/+81
To get correct results, it's currently neccessary to install cygwin using -j1, as cygwin install rules must run after newlib install rules, as they overwrite things installed by them. Also make the installation with sys symlinks, as upload-artifact currently can't handle the default (WSL) symlinks (stat fails EACCESS). Also workaround an issue with download-artifact by removing the libg.a symlink before unpacking the artifact, since otherwise that also fails (open fails EPERM).
2025-05-28newlib: riscv: Align whitespace of size optimized memset()Eric Salem1-4/+4
Align the whitespace of the size optimized implementation of memset() to match the speed optimized version. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Eric Salem <ericsalem@gmail.com>
2025-05-28newlib: riscv: Optimize memset() for speedEric Salem1-71/+262
The RISC-V Zba, Zbkb, and Zilsd/Zclsd extensions provide instructions optimized for bit and load/store operations. Use them when available for the RISC-V port. Also increase loop unrolling for faster performance. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Eric Salem <ericsalem@gmail.com>
2025-05-27RISC-V: memcpy() align dest when misaligned access is prohibitedMahmoud Abumandour1-12/+60
Add a code path for when source and dest are differently aligned. If misaligned access is slow or prohibited, and the alignments of the source and destination are different, we align the destination to do XLEN stores. This uses only one aligned store for every four (or eight for XLEN == 64) bytes of data. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
2025-05-27RISC-V: memcpy() Use inline functions instead of macros and gotosMahmoud Abumandour1-18/+24
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
2025-05-27RISC-V: memcpy() Use uintxlen_t for xlen-sized copyMahmoud Abumandour1-35/+36
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Mahmoud Abumandour <ma.mandourr@gmail.com>
2025-05-26Cygwin: Revise release noteJon Turney1-2/+11
(cherry picked from commit dd10a32cd887b994aa5593bbbb67ecb7164a61ce)
2025-05-22glob: Fix old style function declarations warningsSebastian Huber1-64/+22
2025-05-22glob: Fix incompatible pointer types errorSebastian Huber1-2/+2
This fixes a compile error with GCC 15.
2025-05-22ftw: Fix incompatible pointer types errorSebastian Huber1-1/+3
This fixes a compile error with GCC 15.
2025-05-22libgloss: doc: fix @direntry definitionQuentin Smith1-2/+0
@direntry automatically generates START/END-INFO-DIR-ENTRY. Specifying them again in the source causes install-info to choke on the resulting info file: install-info: START-INFO-DIR-ENTRY without matching END-INFO-DIR-ENTRY
2025-05-22libgloss: rs6000: Add missing function prototypesChris Packham6-0/+12
With recent GCC changes that have elevated some warnings to error by default the rs6000 sim code errors out with: libgloss/rs6000/sim-inbyte.c:22:7: error: implicit declaration of function 'read' [-Wimplicit-function-declaration] libgloss/rs6000/sim-sbrk.c:26:7: error: implicit declaration of function 'brk'; did you mean 'sbrk'? [-Wimplicit-function-declaration] libgloss/rs6000/sim-abort.c:19:3: error: implicit declaration of function 'write' [-Wimplicit-function-declaration] libgloss/rs6000/sim-abort.c:20:3: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] libgloss/rs6000/sim-print.c:29:3: error: implicit declaration of function 'write' [-Wimplicit-function-declaration] libgloss/rs6000/mvme-print.c:34:11: error: implicit declaration of function '__pcrlf' [-Wimplicit-function-declaration] libgloss/rs6000/mvme-print.c:44:19: error: implicit declaration of function '__outln' [-Wimplicit-function-declaration] libgloss/rs6000/mvme-print.c:53:15: error: implicit declaration of function '__outstr' [-Wimplicit-function-declaration] libgloss/rs6000/mbx-print.c:29:3: error: implicit declaration of function 'write' [-Wimplicit-function-declaration] Add extern declarations to avoid the errors.
2025-05-22Cygwin: dll_init: use SIZE_T instead of DWORD for sizeJeremy Drake2-1/+4
The RegionSize member of the MEMORY_BASIC_INFORMATION struct is of type SIZE_T, and it may be larger than will fit in a DWORD (I observed 0x200000000). This resulted in an error due to trying to reserve 0 bytes from VirtualAllloc. Fixes: 8d777a13fcf4 ("* dll_init.cc (reserve_at, release_at): New functions.") Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258154.html Reported-by: Yuyi Wang <Strawberry_Str@hotmail.com> Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-05-21libm: riscv: Reduce sqrt and sqrtf function for code sizezhusonghe2-0/+2
The merged below patch modifies the __ieee754_sqrtf and __ieee754_sqrt functions to use a shared implementation, replacing the original fsqrt.d[s] instruction usage. patch:https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;h=d572c4482b473d7725be0f9380d4f5d8342e4390 Signed-off-by: Songhe Zhu <zhusonghe@eswincomputing.com>
2025-05-21newlib: Regenerate configuration fileEric Salem1-2/+39
Two new C files were added to the RISC-V build, so regenerate the relevant configuration file. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Eric Salem <ericsalem@gmail.com>
2025-05-21newlib: riscv: Optimize memchr() and memrchr()Eric Salem4-83/+249
The RISC-V Zbb, Zbkb, and Zilsd extensions provide instructions optimized for bit and load/store operations. Use them when available for the RISC-V port. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Eric Salem <ericsalem@gmail.com>
2025-05-21newlib: riscv: Add memchr() and memrchr() implementationsEric Salem3-1/+199
Copy stock implementations of memchr() and memrchr() to the RISC-V port. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: Eric Salem <ericsalem@gmail.com>
2025-05-18Cygwin: Only return true from try_to_debug() if we launched a JIT debuggerJon Turney2-1/+6
This fixes constantly replaying the exception if we have a segfault while a debugger is already attached, e.g. stracing a segv, see: https://cygwin.com/pipermail/cygwin/2025-May/258144.html Future work: The 'debugging' static in exception::handle(), which makes us replay the exception the next half a million times it's hit seems like cruft, maybe we should look at if it's possible to remove that? Fixes: 91457377d6c9 ("Cygwin: Make 'ulimit -c' control writing a coredump") Reported-by: Christian Franke <Christian.Franke@t-online.de> Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2025-05-17Cygwin: open: Fix deadlock for opening fifo both side in a processTakashi Yano2-5/+9
Currently, opening both side of fifo in a process hangs if the read side is opened first. The following test case exhibit the hang while it works in linux. #include <unistd.h> #include <pthread.h> #include <sys/stat.h> #include <fcntl.h> #define fifo1 "/tmp/fifo-test" void *thr1(void *) { int fd; usleep(100000); fd = open(fifo1, O_WRONLY); write(fd, "A", 1); usleep(100000); close(fd); return NULL; } int main() { int fd; pthread_t th; char c; mkfifo(fifo1, 0600); pthread_create(&th, NULL, thr1, NULL); fd = open(fifo1, O_RDONLY); pthread_join(th, NULL); read(fd, &c, 1); write(1, &c, 1); close(fd); unlink(fifo1); return 0; } The mechanism of hang is as follows. The main thread tries to open the fifo for reading, but fhandler_fifo::open blocks until it detects that someone is opening the fifo for writing. The other thread wants to do that, but it never gets to the point of calling fhandler_fifo:: open because it is stuck waiting for the lock on cygheap->fdtab. To fix this, this patch delays the construction of the cygheap_fdnew object fd until after fhandler_fifo::open has been called. Fixes: df63bd490a52 ("* cygheap.h (cygheap_fdmanip): New class: simplifies locking and retrieval of fds from cygheap->fdtab.") Reviewd-by: Ken Brown <kbrown@cornell.edu> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-05-14Remove Marcus Shawcroft from MAINTAINERSRichard Earnshaw1-1/+0
2025-05-10Cygwin: console: Fix the console mode for background non-cygwin appTakashi Yano1-7/+8
In the commit 0bfd91d57863, the behaviour of the tty::restore was changed so that the console mode is set to the previouslly stored console mode. Therefore, the console mode for the background non- cygwin app should not be set to tty::restore anymore in setup_for_ non_cygwin_app(). This should have been fixed in that commit. This patch belatedly fixes it. Fixes: 0bfd91d57863 ("Cygwin: console: tty::restore really restores the previous mode") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-05-07Cygwin: console: Store console mode only when console is openedTakashi Yano1-11/+22
... and restore it when app exits. The commit 0bfd91d57863 has a bug that the console mode is stored into the shared memory when both: (1) cygwin process is started from non-cygwin process. (2) cygwin process started from non-cygwin process exits. (1) is intended, but (2) is not. Due to (2), the stored console mode is unexpectedly broken when the cygwin process exits. Then the mode restored will be not as expected. This causes undesired console mode in the use case that cygwin and non-cygwin apps are mixed. With this patch, the console mode will stored only in the case (1). This is done by putting the code, which stores the console mode, into fhandler_console::open() rather than fhandler_console::set_input_mode() and fhandler_console::set_output_mode(). Fixes: 0bfd91d57863 ("Cygwin: console: tty::restore really restores the previous mode") Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-05-03Cygwin: CI: Ignore stress test failures on arm64Jon Turney1-0/+1
Some of the stress-ng tests appear to be flaky on arm64.
2025-05-03Cygwin: docs: fix missing close tag.Jeremy Drake1-1/+1
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-05-03Cygwin: docs: flesh out docs for cygwin_conv_path.Jeremy Drake1-7/+14
Explicitly specify that `from` and `to` are NUL-terminated strings, that NULL is permitted in `to` when `size` is 0, and that `to` is not written to in the event of an error (unless it was a fault while writing to `to`). Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-05-03Revert "Cygwin: CI: Disable stress-ng clock test"Jon Turney1-1/+1
Fixed in 38d22e4ba4e95d1be79055267610117f4ee249be This reverts commit d9e9405becbac3c8bc0c9f23f822fb2339990fab.
2025-05-03Cygwin: CI: Add running on arm64 to stress test matrixJon Turney1-8/+13
Use an output variable from cygwin-install-action to inform where we unpack the just-built cygwin artifact, because apparently the Windows ARM64 runners have a different configuration (no D: drive). Also, drop unused 'target' variable from that matrix
2025-05-03Cygwin: signal: Revive toggling incyg flag in call_signal_handler()Takashi Yano2-3/+8
The commit 68991cda8185 dropped toggling incyg flag in the function call_signal_handler(). However this seems to cause another problem that the command "stress-ng --kill 0 -t 5" sometimes leaves child processes hanging. With this patch additional mechanism to determin whether the target thread is inside cygwin1.dll has been introduced instead. This mechanism utilizes _cygtls::inside_kernel() function with additional argument to return true if the code is in the cygwin DLL even if incyg flag is not set. Fixes: 68991cda8185 ("Cygwin: signal: Do not handle signals while waiting for wakeup evt") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>