aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-04-09Cygwin: globify: read full 32 bit characterCorinna Vinschen2-1/+6
While commit 0321fb573654 ("Cygwin: glob: convert wchar_t to wint_t") switched the entire glob mechanism from wchar_t to wint_t, the globify function calling glob on a DOS command line did not catch up and only checked for the next character constituting a 16 bit wchar_t. This broke reading surrogate pairs from incoming DOS command lines if the string had to go through glob(3). Check for an entire 32 bit unicode char instead. Fixes: 0321fb573654 ("Cygwin: glob: convert wchar_t to wint_t") Reported-by: David Allsopp <david@tarides.com> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-09Cygwin: fhandler_virtual::exists: always set fileidCorinna Vinschen4-4/+20
Commit a0a25849f9dd ("Cygwin: fhandler_virtual: move fileid to path_conv member") broke `ls -l /proc/<PID>'. Turns out, the commit forgot to set the fileid in case of a virtual root dir (i. e., returning virt_rootdir) in fhandlers utilizing fileid. This crashed opendir() due to a random fileid. Make sure to set fileid in any case. Fixes: a0a25849f9dd ("Cygwin: fhandler_virtual: move fileid to path_conv member") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-04Cygwin: fhandler_base::fstat_by_name: improve debug output.Corinna Vinschen1-4/+2
Since we're opening the parent dir, it doesn't make sense to print the name of the file in debug output. Print parent dirname instead. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-04Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILECorinna Vinschen3-3/+6
If FILE_DIRECTORY_FILE is given, FILE_OPEN_NO_RECALL is not allowed, otherwise NtCreateFile returns STATUS_INVALID_PARAMETER. Drop FILE_OPEN_NO_RECALL where FILE_DIRECTORY_FILE is specified. Fixes: f6b56abec186 ("Cygwin: try to avoid recalling offline files") Reported-by: Bruce Jerrick <bmj001@gmail.com> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-04amdgcn: Implement proper locks: Fix ↵Thomas Schwinge1-0/+4
'newlib/libc/sys/amdgcn/include/sys/lock.h' for C++ As of commit 7dd4eb1db9e1b1b9f14ef5b743705156e5f370e1 "amdgcn: Implement proper locks", we get, by the thousands, for C++ code: In file included from [...]/newlib/libc/include/stdio.h:60, from [...]: [...]/newlib/libc/include/sys/reent.h:911:1: error: expected declaration before '}' token
2024-04-03Cygwin: add a fake 3.5.3 release fileCorinna Vinschen1-0/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-02Cygwin: fhandler_virtual: move fileid to path_conv memberCorinna Vinschen8-24/+36
Commit 80f722e97cf7 ("Cygwin: opendir(3): move ENOTDIR check into main function") introduced a bug in fhandler_virtual handling. While the assertion that path_conv::check() already calls exists() and sets FILE_ATTRIBUTE_DIRECTORY accordingly, the exists() function is called on a fhandler_virtual object created for just this code snippet. The side effect of this is that the fileid member in the calling fhandler_virtual object is not set after path_conv::check(). Move the fhandler_virtual::fileid member to path_conv::_virt_fileid and create matching path_conv::virt_fileid() and fhandler_virtual::fileid() methods. Let path_conv::check() propagate the fileid set in the local fhandler_virtual::exists() call to its own _virt_fileid. Use new fhandler_virtual::fileid() method throughout. Fixes: 80f722e97cf7 ("Cygwin: opendir(3): move ENOTDIR check into main function") Reported-by: Bruce Jerrick <bmj001@gmail.com> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-27Cygwin: //: fetch only one item per loopCorinna Vinschen1-13/+9
Simplify code in that it only fetches a single entry per IEnumShellItems::Next call. For some reason this appears to be quicker most of the time. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-25amdgcn: Implement proper locksAndrew Stubbs4-3/+250
This should prevent printf output from multiple threads getting garbled. I don't know why IO ever worked properly -- probably it was always a bit broken -- but the GFX11 devices have a different cache architecture and trying to print from many threads at once corrupted the FILE buffers.
2024-03-24Cygwin: add //tsclient and //wsl$ support to relnotesCorinna Vinschen1-0/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24Cygwin: // and //server: add support for WSLCorinna Vinschen1-10/+43
Root dirs of WSL installations are exposed via \\wsl$. Add support to expose \\wsl$. While at it, check if TERMSRV and P9 provider exist before exposing them. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24Cygwin: dir_cache::add: constify input stringCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24Cygwin: fhandler_netdrive: use WNNC_NET_SMB instead of WNNC_NET_LANMANCorinna Vinschen1-2/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-23Cygwin: //tsclient: allow to enumerate sharesCorinna Vinschen1-1/+5
The //tsclient provider is WNNC_NET_TERMSRV. Fixes: 7db1c6fc4e2a ("Cygwin: //server: revert to using WNet and support NFS shares") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-23Cygwin: //server: revert to using WNet and support NFS sharesCorinna Vinschen3-73/+247
Continue using WSD for enumerating //, but switch back to WNet for enumerating shares. Add trying to enumerate NFS shares for machine names given as FQDN. Only downcase server names, keep case of shares intact. Move downcasing into dir_cache class. Add a comment to explain an extrem weirdness in Windows. Fixes: 205190a80bd0 ("Cygwin: // and //server: switch to Network Discovery") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-22Cygwin: //server: check existence of server with getaddrinfoCorinna Vinschen1-27/+24
Checking server existence by trying to enumerate its shares may result in 2 minutes delay until some internal timeout is hit. In the light that every network is an IP network anyway these days, let's try with a simple getaddrinfo() call. This is usually back in 3 secs even if the server doesn't exist, and it's usually back in 8 secs if the DNS server can't be connected. This is the fastest method I found to check server existence yet. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21Cygwin: utils: refresh tzmap.hCorinna Vinschen1-3/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21Cygwin: tzmap-from-unicode.org: drop "E. Europe Standard Time" defaultCorinna Vinschen1-3/+3
E. Europe Standard Time is available in the unicode.org windowsZones.xml file, so we can drop the default handling. Fix a few comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21Cygwin: tzset(1): use GetDynamicTimeZoneInformationCorinna Vinschen1-62/+5
Use official GetDynamicTimeZoneInformation() function instead of scanning the registry for the timezone keyname. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21Cygwin: fix tzmap-from-unicode.orgCorinna Vinschen1-0/+1
The previous change introduced a missing end of comment Fixes: 60ea9c1c4b66 ("Cygwin: tzmap-from-unicode.org: drop support for Vista/2008") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20Cygwin: utils: refresh tzmap.hCorinna Vinschen1-17/+13
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20Cygwin: tzmap-from-unicode.org: drop support for Vista/2008Corinna Vinschen1-8/+0
Commit b794f2c6038f ("Cygwin: drop support for systems not supporting RFC 4646 locales") erroneously changed tzmap.h manually. Change the script accordingly. Fixes: b794f2c6038f ("Cygwin: drop support for systems not supporting RFC 4646 locales") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20Cygwin: readdir: drop support for NT4/Win2K shares and Samba < 3.0.22Corinna Vinschen2-57/+5
These systems are at least 18 years old and so buggy that they are hopefully not used anymore. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20Cygwin: /proc: fix mem leak in opendir in error caseCorinna Vinschen1-0/+2
Fixes: 1f08558f14e45 ("* fhandler.h (fhandler_proc::opendir): Declare.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20Cygwin: // and //server: switch to Network DiscoveryCorinna Vinschen4-229/+264
SMBv1 is ultimately deprecated since Novemer 2023. It's also not installed by default on latest Windows versions. Drop using the WNet (SMBv1) API in favor of using Network Discovery. Given there's no documented Win32 API for that, the code now uses the Shell API. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20Cygwin: opendir(3): move ENOTDIR check into main functionCorinna Vinschen3-9/+10
So far the check for a directory is in the fhandler::opendir methods. Given that path_conv::check sets FILE_ATTRIBUTE_DIRECTORY on virtual files either, we can move the check up into the opendir(3) function. This avoids calling exists() twice when calling opendir(3). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20Cygwin: (mostly) drop NT4 and Samba < 3.0 supportCorinna Vinschen5-66/+27
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-19Cygwin: dirent.h: fix a commentCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-19Cygwin: readdir(3): stop support for pre-Cygwin 1.5.0 appsCorinna Vinschen1-3/+0
We're filling dirent::__d_internal1 with the inode number to support apps built under Cygwin 1.3 and earlier. This doesn't make sense anymore. Drop this to free up __d_internal1 for other TBD use. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-18winsup/cygwin/fhandler/proc.cc: format_proc_cpuinfo() Linux 6.8 cpuinfo flagsBrian Inglis1-7/+31
add Linux 6.8 cpuinfo flags: Intel 0x00000007:1 eax:17 fred Flexible Return and Event Delivery; AMD 0x8000001f eax:4 sev_snp SEV secure nested paging; document unused and some unprinted bits that could look like omissions; fix typos and misalignments; Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
2024-03-18Revert "Cygwin: glob: perform ignore_case_with_glob on input"Corinna Vinschen2-19/+7
This reverts commit a51147467e6cf58618433286f93d17043e00b0fc. Dumb thinko on my part. What was supposed to be an optimization actually broke caseinsensitive globbing in that the entire input of globbed expressions were downcased. Drop the unused CCHAR() macro nevertheless. Fixes: a51147467e6cf ("Cygwin: glob: perform ignore_case_with_glob on input") Reported-by: Michael Goldshteyn <mgold10000@gmail.com> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-13libc/include/sys/select.h: Use elif not elifdefJoel Sherrill1-1/+1
The cpp directive "elifdef" is only available in very recent GCC versions. This should be able to compile on older toolchains in C99 mode.`
2024-03-13RTEMS: Increase FS_SETSIZE to 256 bitsChris Johns1-0/+2
2024-03-12Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps.Takashi Yano3-32/+68
If pipe reader is a non-cygwin app first, and cygwin process reads the same pipe after that, the pipe has been set to bclocking mode for the cygwin app. However, the commit 9e4d308cd592 assumes the pipe for cygwin process always is non-blocking mode. With this patch, the pipe mode is reset to non-blocking when cygwin app is started. Addresses: https://cygwin.com/pipermail/cygwin/2024-March/255644.html Fixes: 9e4d308cd592 ("Cygwin: pipe: Adopt FILE_SYNCHRONOUS_IO_NONALERT flag for read pipe.") Reported-by: wh <wh9692@protonmail.com> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-03-11Cygwin: 3.6.0: add release entries for pinned/unpinned flag handlingCorinna Vinschen1-0/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-11Cygwin: add 3.5.2 release entries for latest commitsCorinna Vinschen1-0/+7
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-11Cygwin: getgrent: don't skip SAM-only builtin-accountsCorinna Vinschen2-3/+12
Since commit 15e82eef3a40b ("Cygwin: getgrent: fix local SAM enumeration on domain member machines") we skip enumerating local BUILTIN accounts if we also enumerate AD. However, there are two local accounts which are only available in local SAM, not in AD. Don't skip enumerating those. Fixes: 15e82eef3a40b ("Cygwin: getgrent: fix local SAM enumeration on domain member machines") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-11libc/stdio: Remove wchar_t functions from NEWLIB_NANO_FORMATTED_IOTorbjörn SVENSSON2-471/+471
Regression tested in basepoints/gcc-14-9032-g945cb8490cb with arm-none-eabi. Example failure without this change: $ arm-none-eabi-g++ .../pr100611.C -std=c++20 --specs=nosys.specs -o /dev/null --specs=nano.specs .../ld: .../libc_nano.a(libc_a-svfwprintf.o): in function `_svfwprintf_r': (.text._svfwprintf_r+0xd8): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x834): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x85c): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x8a8): undefined reference to `__ssputws_r' .../ld: (.text._svfwprintf_r+0x8dc): undefined reference to `__ssputws_r' .../ld: .../libc_nano.a(libc_a-svfwprintf.o):(.text._svfwprintf_r+0x900): more undefined references to `__ssputws_r' follow collect2: error: ld returned 1 exit status Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
2024-03-08Cygwin: FS_IOC_[GS]ETFLAGS: handle pinned and unpinned attributesCorinna Vinschen5-7/+23
Add FS_PINNED_FL and FS_UNPINNED_FL flags and handle them with mode bits 'p' and 'u' in chattr(1) and lsattr(1). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-08Cygwin: get/set security descriptors using FILE_OPEN_NO_RECALLCorinna Vinschen1-3/+6
Add FILE_OPEN_NO_RECALL to NtOpenFile calls trying to fetch or write file security descriptors so as not to recall them from offline storage inadvertently. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-08Cygwin: try to avoid recalling offline filesCorinna Vinschen7-12/+62
Chances are high that Cygwin recalls offline files from remote storage, even if the file is only accessed during stat(2) or readdir(3). To avoid this - make sure Cygwin is placeholder-aware, - open files in path_conv handling, as well as in stat(2)/readdir(3) scenarios with FILE_OPEN_NO_RECALL, and - during symlink checking or testing for executablility, don't even try to open the file if one of the OFFLINE attributes is set. Reported-by: Marcin Wisnicki <mwisnicki@gmail.com> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-07Cygwin: move EXPORT_ALIAS expressions to end of sourceCorinna Vinschen6-24/+19
This isn't strictly required, but it avoids confusion in ctags. Ctags fails to record the next function or method following the EXPORT_ALIAS expression. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-06Cygwin: pipe: Simplify chhecking procedure of query_hdl.Takashi Yano2-28/+24
This patch eliminates verbose NtQueryObject() calls in the procedure to get query_hdl by storing pipe name into fhandler_base::pc when the pipe is created. fhandler_pipe::temporary_query_hdl() uses the storedpipe name rather than the name retrieved by NtQueryObject(). Suggested-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-03-05Cygwin: pipe: Give up to use query_hdl for non-cygwin apps.Takashi Yano2-44/+17
Non-cygwin app may call ReadFile() for empty pipe, which makes NtQueryObject() for ObjectNameInformation block in fhandler_pipe:: get_query_hdl_per_process. Therefore, do not to try to get query_hdl for non-cygwin apps. Addresses: https://github.com/msys2/msys2-runtime/issues/202 Fixes: b531d6b06eeb ("Cygwin: pipe: Introduce temporary query_hdl.") Reported-by: Alisa Sireneva, Johannes Schindelin <Johannes.Schindelin@gmx.de> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-03-04Cygwin: console: Fix a race issue between close() and open().Takashi Yano2-24/+38
The open() call for console sometimes fails if the console owner process is closing the console by close() at the same time. This is due to mismatch state of con.owner variable and attaching state to the console. With this patch, checking con.owner and attaching to con.owner sequence in open(), and resetting con.owner and freeing console sequence in close() are guarded by output_mutex to avoid such a race issue. Addresses: https://cygwin.com/pipermail/cygwin/2024-March/255575.html Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.") Reported-by: Kate Deplaix <kit-ty-kate@outlook.com> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-03-01Cygwin: cygheap: compute bucket instead of looping over itCorinna Vinschen2-9/+13
Start at index 0 and use 32 bytes as minimal allocation size. Reduce NBUCKETS, we don't have such big objects on the cygheap anyway. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-01Cygwin: cygheap: use SRWLOCK for cygheap lockingCorinna Vinschen1-7/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-01Cygwin: posix_getdents: do not clear attached DIR structure at fork(2)Corinna Vinschen1-1/+0
The upcoming POSIX issue 8 will require that posix_getdents after fork() will pick up at the right spot, independently of being called in the parent or in the child process. Remove the expression clearing out the attached DIR after fork. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-01Cygwin: lseek: improve seeking posix_getdents descriptorsCorinna Vinschen1-22/+61
Transfer code lseeking on posix_getdents() directory descriptor into its own static function and rework it so SEEK_END, SEEK_DATA and SEEK_HOLE work here as expected, too. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-01Cygwin: console: Do not unmap shared console memory belonging to ctty.Takashi Yano2-3/+12
In the condition that console setup for CTTY and close run at the sametime, accessing shared console memory which is already unmapped may occur. With this patch, to avoid this race issue, shared console memory which belongs to contorolling terminal (CTTY) is kept mapped as before. Addresses: https://cygwin.com/pipermail/cygwin/2024-February/255561.html Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.") Reported-by: Kate Deplaix <kit-ty-kate@outlook.com> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>