aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-07-10newlib: Regenerate configuration filesm fally1-26/+26
Regenerate the configuration files since a file was replaced in the RISC-V port, and one other file was renamed. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: m fally <marlene.fally@gmail.com>
2025-07-10RISC-V: memmove() speed optimized: Call memcpy()m fally1-67/+93
Redirect to memcpy() if the memory areas of source and destination do not overlap. Only redirect if length is > SZREG in order to reduce overhead on very short copies. Signed-off-by: m fally <marlene.fally@gmail.com>
2025-07-10RISC-V: memmove() speed optimized: Align source addressm fally1-50/+135
If misaligned accesses are slow or prohibited, either source or destination address are unaligned and the number of bytes to be copied is > SZREG*2, align the source address to xlen. This speeds up the function in the case where at least one address is unaligned, since now one word (or doubleword for rv64) is loaded at a time, therefore reducing the amount of memory accesses necessary. We still need to store back individual bytes since the destination address might (still) be unaligned after aligning the source. The threshold of SZREG*2 was chosen to keep the negative effect on shorter copies caused by the additional overhead from aligning the source low. This change also affects the case where both adresses are xlen- aligned, the memory areas overlap destructively, and length is not a multiple of SZREG. In the destructive-overlap case, the copying needs to be done in reversed order. Therefore the length is added to the addresses first, which causes them to become unaligned. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: m fally <marlene.fally@gmail.com>
2025-07-10RISC-V: memmove() speed optimized: Add loop-unrollingm fally1-9/+48
Add loop-unrolling for the case where both source and destination address are aligned in the case of a destructive overlap, and increase the unroll factor from 4 to 9 for the word-by-word copy loop in the non-destructive case. This matches the loop-unrolling done in memcpy() and increases performance for lenghts >= SZREG*9 while almost not at all degrading performance for shorter lengths. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: m fally <marlene.fally@gmail.com>
2025-07-10RISC-V: memmove() speed optimized: Replace macros and use fixed-width typesm fally1-25/+35
Replace macros with static inline functions or RISC-V specifc macros in order to keep consistency between all functions in the port. Change data types to fixed-width and/or RISC-V specific types. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: m fally <marlene.fally@gmail.com>
2025-07-10RISC-V: memmove() speed optimized: Add implementationm fally4-15/+100
Copy the common implementation of memmove() to the RISC-V port. Rename memmove.S to memmove-asm.S to keep naming of files consistent between functions. Update Makefile.inc with the changed filenames. Reviewed-by: Christian Herber <christian.herber@oss.nxp.com> Signed-off-by: m fally <marlene.fally@gmail.com>
2025-07-09Cygwin: testsuite: test posix_spawn_file_actions_addopen with O_CLOEXECJeremy Drake1-0/+10
This was previously not handled correctly by newlib. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-07-09posix_spawn: preserve FD flags when processing FAE_OPENJeremy Drake1-3/+11
According to the POSIX documentation, "when the new process image is executed, any file descriptor (from this new set) which has its FD_CLOEXEC flag set shall be closed (see posix_spawn())." The "new set" is after processing the file actions, so if addopen had the O_CLOEXEC flag set the descriptor should be closed after the exec. The adddup2 docs, by contrast, specify that the flag should be cleared, even if dup2 wouldn't have done so due to the specified file descriptors being equal. Add a comment to that effect. Addresses: https://sourceware.org/pipermail/newlib/2025/021968.html Fixes: c7c1a1ca1b ("2013-10-01 Petr Hosek <phosek@chromium.org>") Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-07-09Cygwin: CI: cygstress: remove 'filerace', 'flock' and 'fork' from CIChristian Franke1-3/+4
The 'filerace' test may run longer than the watchdog timeout. 'flock' and 'fork' may leave processes behind for some unknown reason. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-07-08Cygwin: open: only fix file attributes when trying to create fileCorinna Vinschen2-2/+5
Only try to fix the cached DOS attributes if the caller actually tried to create the file. Otherwise the fixup code is called even in cases where we open the file with minimal query access bits and NtQueryInformationFile() could fail with STATUS_ACCESS_DENIED and the new cached DOS attributes are wrong again. Fixes: 37c49decc835f ("Cygwin: open: only fix up cached DOS file attributes for on-disk files") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-07Cygwin: spawn: apply PID_NEW_PG flag to spawned childJeremy Drake1-6/+11
Previously, it was always applied to "myself", which is only appropriate in the case of _P_OVERLAY (aka exec). Apply the flag to "myself" only in that case, and apply it to the new child instead in other cases. Also, clear the flag from "myself" in the case of a failed exec. Fixes: 8d8724ee1b5a ("Cygwin: pty: Fix Ctrl-C handling further for non-cygwin apps.") Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-07-07Cygwin: define OUTPUT_FORMAT and SEARCH_DIR for AArch64Radek Bartoň1-1/+3
This patch defines binutils output binary format for AArch64 which is pei-aarch64-little. Since =/usr/lib/w32api resolves to $SYSROOT/usr/lib/w32api and Fedora cross-build takes libraries from /usr/aarch64-pc-cygwin/sys-root/usr/lib/w32api, the SEARCH_DIR("/usr/x86_64-pc-cygwin/lib/w32api"); is redundant and can be removed. Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-05Cygwin: CI: cygstress: add ability to run all tests multiple timesChristian Franke1-28/+135
Add options '-e' and '-r' to control error behavior and number of test runs. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-07-05Cygwin: CI: cygstress: update for stress-ng 0.19.02 and current CygwinChristian Franke1-29/+35
Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-07-04libc: mips: fix strcmp bug for little endian targetsFaraz Shahbazker1-2/+5
strcmp gives incorrect result for little endian targets under the following conditions: 1. Length of 1st string is 1 less than a multiple of 4 (i.e len%4=3) 2. First string is a prefix of the second string 3. The first differing character in the second string is extended ASCII (that is > 127) Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: UHI linker scripts fail to link with _isr_vec_count=1Faraz Shahbazker3-6/+6
This _isr_vec_count=1 is prevalent in MIPS Open FGPA examples. Looks like forcing _isr_vec_007 in to the link was a mistake and we always intended to only include the top-level _isr_vec symbol. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: g++ exception handling failure on o32 elf targetsFaraz Shahbazker3-3/+22
The compiler driver positions the linker script at the end of the linker command-line, after crtend.o. As a result, any INPUT objects and archive GROUPs introduced by the linker script end up after crtend.o. This messes up the end-of-frame marker provided by crtend.o This has always been a problem, but a recent binutils update to clean-up redundant NULL markers in .eh_frame exposes it as a execution failure in exception-handling tests. This patch re-orders .eh_frame in all linker scripts so that the one from crtend.o is placed last. An alternative approach would be to fix the compiler driver to put the linker script before the ENDFILE spec. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libc: mips: Improve performance of strcmp implementationFaraz Shahbazker1-79/+123
Improve `strcmp` by using `ext` instruction, if available. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libc: mips: memcpy prefetches beyond copied memoryFaraz Shahbazker1-53/+97
Fix prefetching in core loop to avoid exceeding the operated upon memory region. Revert accidentally changed prefetch-hint back to streaming mode. Refactor various bits and provide pre-processor checks to allow parameters to be overridden from compiler command line. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libc: mips: Add improved C implementation of memcpy/memsetFaraz Shahbazker4-5/+586
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: Fixes and improvements for CM3 bootcodeMatthew Fortune4-33/+27
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: Boot and startup code improvements inc. linker script fixesRobert Suchanek7-47/+144
Add .eh_frame_hdr and .gnu_extab to linker scripts for compactEH Fix orphaned .gcc_except_table sections in uhi32.ld. Fix orphaned .gcc_except_table sections in mti32.ld. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: Add srec2hex.pl for preparing input to simulatorsMatthew Fortune3-0/+205
srec2hex.pl is a PERL script file which converts S-record file to a MIPS HEX file, which can be useful for some simulation environments. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04libgloss: mips: Add mipshal.mkJovan Dmitrović2-0/+148
Make using MIPS HAL component easier by including `mipshal.mk` into source Makefile. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04mips: Implement MIPS HAL and UHIJovan Dmitrović120-535/+15841
Implement abstract interface for MIPS, including unified hosting interface (UHI). Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-04aarch64: Export fe{enable,disable,get}except on CygwinRadek Bartoň1-4/+12
For aarch64 on ELF targets, the library does not export fe{enable,disable,get}except as symbols from the library, relying on static inline functions to provide suitable definitions if required. But for Cygwin we need to create real definitions to satisfy the DLL export script. So arrange for real definitions of these functions when building on Cygwin. Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-03Cygwin: gentls_offsets: port to support AArch64Radek Bartoň1-2/+2
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-03Cygwin: GetArm64ProcAddress: drop unsupported __i386__ code branchCorinna Vinschen1-4/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-03Cygwin: add fastcwd to AArch64 buildRadek Bartoň1-0/+5
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-03Cygwin: format_process_maps: avoid crashing PID when fetching heap infoCorinna Vinschen2-3/+34
To fetch heap info for a process in our /proc/PID/maps emulation, we call RtlQueryProcessDebugInformation on this process since commit b4966f91396b ("(heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation"). However, it turns out that this call can crash the targeted process, if it's called from multiple threads or processes in parallel. Worse, the entire code from creating the debug buffer, over fetching the debug info, subsequent collecting the information from said debug buffer, up to destroying the buffer, needs to be guarded against parallel access. We do this by adding a global mutex object, serializing access to the debug info of a process. Reported-by: Christian Franke <Christian.Franke@t-online.de> Fixes: b4966f91396b ("(heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-03Cygwin: dlsym: fetch module list via EnumProcessModulesCorinna Vinschen2-24/+13
We're using RtlQueryProcessDebugInformation from dlsym since commit 31ddf45dd8694 ("* autoload.cc (EnumProcessModules): Remove.") Observations on the Cygwin mailing list show that calling RtlQueryProcessDebugInformation on a process is neither thread-safe, nor multi-process-safe, see https://cygwin.com/pipermail/cygwin/2025-July/258403.html for details. This patch essentially reverts 31ddf45dd8694. Fetch the list of loaded modules in the current process by calling EnumProcessModules again. Reported-by: Christian Franke <Christian.Franke@t-online.de> Fixes: 31ddf45dd8694 ("* autoload.cc (EnumProcessModules): Remove.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-03Cygwin: console: Set console mode only if std{in,out,err} is consoleTakashi Yano2-15/+27
Currently, when cygwin app is launched, the console input mode is set to tty::cygwin, even if the stdin is not a console. However, it is not necessary because the cygwin app does not use stdin. This also applies to stdout and stderr. With this patch, the console mode is set only when std{in,out,err} is a console for the cygwin app for better coexistence with non- cygwin apps. Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-07-03Cygwin: console: Call set_input_mode() after changing disable_master_threadTakashi Yano1-4/+9
With the commit 476135a24506, set_input_mode() reffers to the flag disable_master_thread in tty::cygwin mode. So it is necessary to call set_input_mode() after changing disable_master_thread flag. However, the commit 476135a24506 was missing that. With this patch, set_input_mode() is called after changing the flag disable_master_thread, if the console input mode is tty::cygwin. Fixes: 476135a24506 ("Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread"); Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-07-02wcstombs: also call __WCTOMB on terminating NUL if output buffer is NULLChristian Franke1-3/+4
A __WCTOMB call on the terminating NUL may emit more than a NUL byte. This is the case if the string ends with a lone UTF-16 high surrogate. Fixes: 2a3a02a68764 ("Add SUSV2 support for calculating size if output buffer is NULL") Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-07-02newlib: increase jump buffer length to 25 to fit all non-volatile registers ↵Radek Bartoň1-1/+10
for aarch64-pc-cygwin Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-07-02cygwin: faq-programming-6.21 unmatched parenthesisJohn Haugabook1-1/+1
Fix typo - parenthesis without an opening parenthesis. Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
2025-07-02cygwin: faq-programming-6.21 ready-made download commandsJohn Haugabook1-0/+12
Running setup-x86_64.exe and performing an individual search for each package, is a pain in the neck. And the user running "setup-x86_64.exe -q -P packageName" may have a typo and the package would not be installed. So by copying and pasting these commands into the terminal setup-x86_64.exe runs a preliminary search, so when they reach the "Select Packages" window these packages will be amongst the packages ready to be downloaded. Additionally sorting them makes it easier to go down the list, and make sure all packages are listed. Putting separate commands allows the user to pick which packages to download in the case they want to run config, where those packages are not needed i.e. --without-cross-bootstrap. Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
2025-07-02cygwin: faq-programming-6.21 add 5 required packagesJohn Haugabook1-11/+13
Add 5 additional packages: for build: libtool; for dumper utility: libiconv, libiconv2; for documentation: perl-XML-SAX-Expat, docbook-utils. When building from a sandbox environment on Windows 11 using the packages currently listed in faq 6.21, I got the below error after calling "make": """"""""""""""" make[3]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/testsuite' Making all in doc make[3]: Entering directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/doc' GEN Makefile.dep GEN cygwin-ug-net/cygwin-ug-net.pdf GEN cygwin-api/cygwin-api.pdf GEN cygwin-api/cygwin-api.html etc... GEN cygwin-api.info could not find ParserDetails.ini in /usr/share/perl5/vendor_perl/5.40/XML/SAX warning : xmlAddEntity: invalid redeclaration of predefined entity 'lt' sh: line 1: /usr/bin/iconv: No such file or directory -: warning: document without nodes GEN cygwin-ug-net.info could not find ParserDetails.ini in /usr/share/perl5/vendor_perl/5.40/XML/SAX warning : xmlAddEntity: invalid redeclaration of predefined entity 'lt' docbook2texi://refentry[@id='proc']/refnamediv: section is too deep docbook2texi://refsect1[@id='proc-desc']: section is too deep etc... sh: line 1: /usr/bin/iconv: No such file or directory -: warning: document without nodes make[3]: *** [Makefile:721: cygwin-ug-net.info] Error 141 make[3]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/doc' make[2]: *** [Makefile:398: all-recursive] Error 1 make[2]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup' make[1]: *** [Makefile:9464: all-target-winsup] Error 2 make[1]: Leaving directory '/home/WDAGUtilityAccount/build-newlib' make: *** [Makefile:883: all] Error 2 """"""""""""""" Added the packages: libtool, libiconv, libiconv2, perl-XML-SAX-Expat, and docbook-utils. Ran "make" again, and the error was resolved, and the install completed. In the case that someone is using a similar OS (Windows 10 and 11), architecture (x64-based PC), and/or verions of cygwin (3.6.3) for building cygwin from newlib-cygwin, this commit may prevent those errors from occuring. Additionally sorting the packages makes it easier to go down the list when selecting from the "Select Packages" GUI window from setup-x86_64.exe, making sure all packages have been checked. Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
2025-07-02RISC-V: Fix memcpy() for GCC 13Sebastian Huber1-2/+2
GCC 13 does not define the __riscv_misaligned_* builtin defines. They are supported by GCC 14 or later. Test for __riscv_misaligned_fast to select an always correct memcpy() implementation for GCC 13. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2025-07-01Cygwin: Aarch64: optimize pthread_wrapper register usageThirumalai Nagalingam1-10/+11
This patch resolves issues related to unsafe access to deallocated stack memory in the pthread wrapper for AArch64. Key changes: - Removed use of x19 by directly loading the thread function and argument using LDP from [WRAPPER_ARG], freeing one register. - Stored thread function and argument in x20 and x21 before VirtualFree to preserve them across calls. - Used x1 as a temporary register to load the stack base, subtract CYGTLS, and update SP. - Moved the thread argument back into x0 after VirtualFree and before calling the thread function. Earlier, `wrapper_arg` lived on the stack, which was freed via `VirtualFree`, risking segfaults on later access. Now, the thread `func` and `arg` are loaded before the stack is freed, stored in callee-saved registers, and restored to `x0` before calling the thread function. Fixes: f4ba145056db ("Aarch64: Add inline assembly pthread wrapper") Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
2025-07-01Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_threadTakashi Yano1-1/+1
Currently, ENABLE_PROCESSED_INPUT is set in set_input_mode() if master_thread_suspended is true. This enables Ctrl-C handling when cons_master_thread is suspended, since Ctrl-C is normally handled by cons_master_thread. However, when disable_master_thread is true, ENABLE_PROCESSED_INPUT is not set, even though this also disables Ctrl-C handling in cons_master_thread. Due to this bug, the command C:\cygwin64\bin\sleep 10 < NUL in the Command Prompt cannot be terminated with Ctrl-C. This patch addresses the issue by setting ENABLE_PROCESSED_INPUT when either disable_master_thread or master_thread_suspended is true. This bug also affects cases where non-Cygwin Git (Git for Windows) launches Cygwin SSH. In such cases, SSH also cannot be terminated with Ctrl-C. Addresses: https://github.com/git-for-windows/git/issues/5682#issuecomment-2995983695 Fixes: 746c8116dd4f ("Cygwin: console: Allow pasting very long text input.") Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-06-30Cygwin: testsuite: test relative path to exe after addchdir.Jeremy Drake1-0/+8
This is apparently relative to the new cwd, but my implementation is currently treating it as relative to the parent's cwd, so it's worth testing. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-06-30Cygwin: testsuite: test passing directory fd to childJeremy Drake2-0/+23
This is a legal (if non-obvious) thing to do, so test it. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-06-30Cygwin: testsuite: test posix_spawn of a non-Cygwin executable.Jeremy Drake2-0/+171
Test CWD and redirection of standard handles. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-06-30Cygwin: testsuite: add a mingw test program to spawnJeremy Drake4-4/+139
This program is currently meant to test standard file handles and current working directory (since these are settable via posix_spawn), but could be extended to add additional checks if other cygwin-to-win32 process properties need to be tested. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-07-01Cygwin: pipe: Add missing code restoring real_non_blocking_modeTakashi Yano1-2/+8
Fixes: 940dbeffa713 ("Cygwin: pipe: Fix unexpected blocking mode change by pipe_data_available()") Reported by: Andrew Ng <anng.sw@gmail.com> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-07-01Cygwin: Add release message for recent pipe fixesTakashi Yano1-0/+6
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-07-01Cygwin: pipe: Simplify raw_write() a bit (Drop using chunk)Takashi Yano1-8/+2
There are tree variables for similar purpose in raw_write(), avail, chunk, and len1. avail is the amount of writable space in the pipe. len1 is the data length to attempt to NtWriteFile(). And chunk is intermediate value to calculate len1 from avail which holds min(avail, len). Here, chunk has no clear role among them. In fact, it appears to obscure the intent of the code for the reader. This patch removes the use of chunk and obtains len1 directly from avail. Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-07-01Cygwin: pipe: Fix unexpected blocking mode change by pipe_data_available()Takashi Yano3-7/+9
ipipe_data_available() is called from raw_write(). If the pipe is in real_non_blocking_mode at that time, calling pipe_data_available() can, in some cases, inadvertently revert the pipe to blocking mode. Here is the background: pipe_data_available() checks the amount of writable space in the pipe by calling NtQueryInformationFile() with the FilePipeLocalInformation parameter. However, if the read side of the pipe is simultaneously consuming data with a large buffer, NtQueryInformationFile() may return 0 for WriteQuotaAvailable. As a workaround for this behavior, pipe_data_available() temporarily attempts to change the pipe-mode to blocking. If the pipe contains data, this operation fails-indicating that the pipe is full. If it succeeds, the pipe is considered empty. The problem arises from the assumption that the pipe is always in real blocking mode before attempting to flip the mode. However, if raw_write() has already set the pipe to non-blocking mode due to its failure to determine available space, two issues occur: 1) Changing to non-blocking mode in pipe_data_available() always succeeds, since the pipe is already in non-blocking mode. 2) After this, pipe_data_available() sets the pipe back to blocking mode, unintentionally overriding the non-blocking state required by raw_write(). This patch addresses the issue by having pipe_data_available() check the current real blocking mode, temporarily flip the pipe-mode and then restore the pipe-mode to its original state. Addresses: https://github.com/git-for-windows/git/issues/5682#issuecomment-2997428207 Fixes: 7ed9adb356df ("Cygwin: pipe: Switch pipe mode to blocking mode by default") Reported-by: Andrew Ng <andrew.ng@sony.com> Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-07-01Cygwin: pipe: Make pipe_data_available() return PDA_UNKNOWNTakashi Yano3-12/+16
... rather than 1 when the pipe space estimation fails, so that select() and raw_wrie() can perform appropriate fallback handling. In select(), even if pipe space is unknown, return writable to avoid deadlock. Even with select() returns writable, write() can blocked anyway, if data is larger than pipe space. In raw_write(), if the pipe is real non-blocking mode, attempting to write larger data than pipe space is safe. Otherwise, return error. For other cases than FH_PIPEW, PDA_UNKNOWN never orrurs. Therefore, it is not necessary to handle it in that cases. Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>