aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-02-21libgloss: arm: Clean up assembly syntax for clang compatibilityVolodymyr Turanskyy1-53/+56
* Use mrc p15 co-processor instruction syntax. * Align register_names so that we can use ADR rather than ADRL. Change-Id: I005cd5a1fc55ec8eba90929c6c70d6a202b0746d
2025-02-21Cygwin: fhandler_netdrive::exists: fix new debug statementCorinna Vinschen1-4/+5
The debug statement was wrong twice: Not only was it in the wrong spot, it was also supposed to print the share name and missed to add said argument. Fixes: df307349a09e ("Cygwin: fhandler_netdrive::exists: add debug statement") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-20Cygwin: fhandler_netdrive::exists: add debug statementCorinna Vinschen1-2/+5
Add a debug_printf printing the return code from GetAddrInfoW. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-19Fix mips libgloss supportRoger Sayle10-30/+34
* glue.h (print): Provide prototype. * kill.c: Prototype _exit with noreturn attribute. * mips/cfe_mem.c (memtop): Change to a pointer type. (__libcfe_meminit): Add casts to avoid compilation warnings/errors. * mips/cma101.c: Prototype __cpu_timer_poll and __cpu_flush. (convertbcd): Update K&R-style function declaration. (time): Likewise. * mips/nullmon.c (get_mem_info): Likewise. * mips/syscalls.c: Declare struct s_mem and prototype get_mem_info. (sbrk): Update K&R-style function declaration. Add casts to avoid compilation warnings/errors. * mips/test.c: Prototype outbyte and print. Fix return type of main. * print.c (print): Make ptr argument const char*. * putnum.c: Remove print prototype, which is now in glue.h. * write.c: Remove outbyte prototype, which is now in glue.h. Co-authored-by: Mike Frysinger <vapier@gentoo.org>
2025-02-19Cygwin: skip floppy drives in cygdrive_getmntent.Jeremy Drake via Cygwin-patches4-9/+26
This was previously done, but was lost when the function was updated to list all Windows mount points, not just drive letters. Fixes: 04a5b072940cc ("Cygwin: expose all windows volume mount points.") Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-19Cygwin: include network mounts in cygdrive_getmntent.Jeremy Drake via Cygwin-patches1-32/+113
After migrating from GetLogicalDrives to Find(First|Next)VolumeW, mapped network drives no longer showed up in getmntent output. To fix that, also iterate GetLogicalDriveStringsW when builing dos_drive_mappings, and merge with volume mounts (skipping any volume mounts that are just mounted on the root of a drive, and replacing the dos mounts in the mapping for a volume which is mounted on both a drive root and a directory). Fixes: 04a5b072940cc ("Cygwin: expose all windows volume mount points.") Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257384.html Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-17Cygwin: pathnames.xml: sparse mount option is always set on SSDsCorinna Vinschen1-0/+1
Reported by: Christian Franke <Christian.Franke@t-online.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-17strcasecmp family: cast character to unsigned when calling tolowerCorinna Vinschen4-10/+10
The strcasecmp family of functions (strcasecmp, strncasecmp, strcasecmp_l, strncasecmp_l) call tolower on the incoming character before comparison. tolower takes an int as parameter. All four strcasecmp functions neglect to cast the character to unsigned before using it as parameter to tolower. This tolower is called with negative values if the incoming character is not in the ASCII range. This breaks case-insensitive comparison in other singlebyte codesets like ISO-8859-1 with native characters. Adding casts to unsigned char when calling tolower fixes it. Reported-by: Bruno Haible <bruno@clisp.org> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-14unistd.h: enable SEEK_DATA and SEEK_HOLE also for POSIX-1.2024Christian Franke1-1/+1
https://pubs.opengroup.org/onlinepubs/9799919799/functions/lseek.html Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-02-14Cygwin: lseek: fix an off-by-one condition in SEEK_DATA/SEEK_HOLECorinna Vinschen2-1/+10
The conditional checking if lseek should return ENXIO checks the offset being bigger than the current filesize, but accidentally not for being equal to the current filesize. This can lead to an endless loop in newer versions of cp(1). Fixes: edfa581d3c5a7 ("Cygwin: lseek: implement SEEK_DATA and SEEK_HOLE for files") Reported-by: Christian Franke <Christian.Franke@t-online.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-14Cygwin: pathnames.xml: explain dir mounts since 3.6.0Corinna Vinschen1-0/+20
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-14Cygwin: pathnames.xml: improve chapters mount-table and cygdriveCorinna Vinschen1-16/+23
Fix case in example output of mount and a bunch of clumsy expressions and descriptions in the cygdrive section. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-14Cygwin: new-features.xml: transfer 3.6.0 release message to docsCorinna Vinschen1-0/+153
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-14Cygwin: new-features.xml: drop two dashes remaining from copy/pasteCorinna Vinschen1-2/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-14Cygwin: 3.6.0: add release entries for my patches.Jeremy Drake via Cygwin-patches1-0/+21
These are: 04a5b07294 Cygwin: expose all windows volume mount points. 0d113da235 Cygwin: /proc/<PID>/mount*: escape strings. 7923059bff Cygwin: uname: add host machine tag to sysname. b091b47b9e cygthread: suspend thread before terminating. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-13Cygwin: always output cygdrive mntents.Jeremy Drake via Cygwin-patches1-35/+3
Previously, if there was an explicit mount entry for a drive letter (say, C:), the output of the corresponding cygdrive mntent (like /cygdrive/c) would be suppressed. Once Windows directory mounts were added to cygdrive mounts, the de-duplication code got more complicated. Instead, always output the cygdrive mounts, under the cygdrive prefix. Addresses: https://cygwin.com/pipermail/cygwin-patches/2025q1/013367.html Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-13Cygwin: expose all windows volume mount points.Jeremy Drake via Cygwin-patches5-52/+100
They are exposed via the getmntent API and proc filesystem entries dealing with mounts. This allows things like `df` to show volumes that are only mounted on directories, not on drive letters. Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257251.html Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-13Cygwin: store list of mounts for volumes in dos_drive_mappings.Jeremy Drake via Cygwin-patches2-18/+39
The existing code only stored the first mount for each volume, but now we store the complete list, and split it into a linked list. This will be used in a subsequent commit to populate cygdrive mount entries. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-12Protect strcat from accessing an unaligend long pointerAlexey Lapshin1-9/+12
- related to Bug libc/32679
2025-02-11Protect strncat from accessing an unaligend long pointerJeff Johnston1-9/+12
- fixes Bug libc/32679
2025-02-10newlib: Regenerate autotools filesCorinna Vinschen3-6/+74
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-10newlib: introduce --enable-newlib-hw-misaligned-access optionAlexey Lapshin7-2/+67
Some hardware may perform better when copying unaligned word-sized memory compared to byte-by-byte copying. In case not defined explicitly by --enable-newlib-hw-misaligned-access config option or variable $default_newlib_hw_misaligned_access in configure.host file the compiler check will be performed to detect if __riscv_misaligned_fast or __riscv_misaligned_slow is defined. This commit introduces autodetection for RISC-V. Additionally, checking for __ARM_FEATURE_UNALIGNED could be checked for ARM architecture. However, this was not implemented in the commit, as changes in newlib/libc/machine/[arm|aarch64] need to be performed.
2025-02-10newlib: str[n]cat: optimize skipping of the destination stringAlexey Lapshin2-17/+18
Prepare pointer to be aligned and than use word-size iterator on aligned memory.
2025-02-10newlib: memmove: improve performance for overlapping buffersAlexey Lapshin1-3/+21
This change provides word-sized copy for overlapping buffers, that could increase performance significantly. Performance measurement for RISCV: uint8_t buf[1024]; memmove (buf + 4, buf, sizeof(buf) - 4); CPU cycles: 12255 -> 2076
2025-02-10newlib: mem[p]cpy/memmove improve performance for optimized versionsAlexey Lapshin3-3/+3
This change improves performance on memory blocks with sizes in range [4..15]. Performance measurements made for RISCV machine (memset): size 4, CPU cycles change: 50 -> 37 size 5, CPU cycles change: 57 -> 40 size 6, CPU cycles change: 64 -> 47 size 7, CPU cycles change: 71 -> 54 size 8, CPU cycles change: 78 -> 44 size 9, CPU cycles change: 85 -> 47 size 10, CPU cycles change: 92 -> 54 size 11, CPU cycles change: 99 -> 61 size 12, CPU cycles change: 106 -> 51 size 13, CPU cycles change: 113 -> 54 size 14, CPU cycles change: 120 -> 61 size 15, CPU cycles change: 127 -> 68
2025-02-10newlib: memccpy: unify mask filling with other memory functionsAlexey Lapshin1-4/+5
This change made just to have memccpy like others mem-functions
2025-02-10newlib: string: refactor str/mem-family functionsAlexey Lapshin20-433/+124
Move common macros to local.h header
2025-02-05Cygwin: /proc/<PID>/mount*: escape strings.Jeremy Drake via Cygwin-patches1-10/+66
In order for these formats to be machine-parseable, characters used as delimiters must be escaped. Linux escapes space, tab, newline, backslash, and hash (because code that parses mounts/mtab and fstab would handle comments) using octal escapes. Replicate that behavior here. Addresses: https://cygwin.com/pipermail/cygwin/2024-June/256082.html Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-03Cygwin: factor out code to resolve a symlink target.Jeremy Drake via Cygwin-patches1-34/+28
This code was duplicated between the lnk symlink type and the native symlink type. Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
2025-02-03libgloss: arc: Add clock() system call to libnsimYuriy Kolerov4-2/+37
clock() system call is used in some GDB tests thus it is necessary to implement it for testing purposes. A value for clock() is taken from a default timer (timer 0). If it is not presented than the error value (-1) is returned. Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2025-02-03libgloss: arc: Add _getentropy stubYuriy Kolerov3-0/+21
Stub function for _getentropy is presented in libnosys and it is not presented in libgloss libraries for ARC. When libstdc++ is built it detects that _getentropy is presented in the default libgloss library (libnosys). However, then GCC fails to link applications with another libgloss libraries like nSIM, HostLink, boards, etc. because of missing _getentropy stub in corresponding libraries. Here is an example: $ cat getentropy.cpp #include <unistd.h> int main () { unsigned i; ::getentropy(&i, sizeof(i)); return 0; } $ arc64-elf-g++ -mcpu=hs6x -specs=nsim.specs getentropy.cpp ... ... undefined reference to `_getentropy' collect2: error: ld returned 1 exit status Thus, it is necessary to add _getentropy stub to all ARC libgloss libraries to prevent errors while building even simple C++ programs. Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2025-02-03Lift 256 arg limit in execl, execle and execlpTerraneo Federico7-6/+140
add --enable-newlib-use-malloc-in-execl option The previous version of these functions allocated a 256 entry array and copied arguments in that array with no bound checking. That implementation always occupied 1024 bytes of stack for the array even in the common case in which the number of passed arguments is far less than 256, risking stack overflows in environments with small stacks, and caused a stack buffer overflow if called with more than 256 arguments. The improved implementation counts the actual number of passed arguments and allocates a suitable buffer. The default implementation uses alloca to allocate the buffer to satisfy the POSIX.1-2008 requirement that execl and execle should be callable from signal handlers, but it is possible to override this behavior and use malloc for targets where the risk of stack overflow due to unbounded stack allocations is a more pressing requirement than the corner case of allowing execl calls from signal handlers.
2025-02-03newlib: update Makefile.inTerraneo Federico1-339/+276
The libc/sys/xtensa directory was removed in commit 48f1655c955c154b3165692e02aa66699212453c, but the change to Makefile.in wasn't committed.
2025-01-28Cygwin: implement posix_closeCorinna Vinschen24-59/+120
per https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_close.html Add a flag value to fhandler_*::close() and close_with_arch() methods, taking -1 as default argument, used to indicate default close(2) behaviour. The only fhandlers capable of returning EINTR are the INET based socket fhandlers. Handle -1 and POSIX_CLOSE_RESTART equivalent, making close() and posix_close(POSIX_CLOSE_RESTART) behaving identically. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-28Cygwin: fhandler: move "isclosed" status flag into fhandler_pipe_fifoCorinna Vinschen6-7/+16
The isclosed flag is only used in pipe and FIFO code, so move the flag down into the fhandler_pipe_fifo class. Note that such a flag is not sufficient to avoid evil, like closing an already closing fhandler from another thread. If we ever need this, it has to be implemented threadsafe. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-28unistd.h: declare posix_closeCorinna Vinschen1-0/+10
Declare posix_close, a new function defined by POSIX-1.2024, per https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_close.html Define POSIX_CLOSE_RESTART. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-27Cygwin: message queues: avoid deadlocks in multi-threaded processesCorinna Vinschen2-5/+9
Deadlocks have been observed if the message queue functions are called from different threads in the same process. Remove incorrectly locking the descriptor table while accessing the message queue fhandler, potentially calling blocking functions. Fixes: 46f3b0ce85a9 ("Cygwin: POSIX msg queues: move all mq_* functionality into fhandler_mqueue") Reported-by: Christian Franke <Christian.Franke@t-online.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-27Cygwin: message queues are not devicesCorinna Vinschen4-7/+9
Message queues are basically just files and in most cases can be handled like normal files. So it was a mistake to set the "on-disk-device" flag for them to fix the mq_unlink() problem reported in https://cygwin.com/pipermail/cygwin/2025-January/257119.html Rather, given that unlink() just checks if the object to be deleted has an on-disk representation, make sure message queues are added to the path_conv::isondisk() predicate. This also reverts commit d870655f570f25393dcefbaf0b1dc807f277749c. Fixes: d870655f570f ("Cygwin: path_conv: set on-disk-device flag for message queue files") Reported-by: Christian Franke <Christian.Franke@t-online.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-25Cygwin: add release msg for mq_unlink changesCorinna Vinschen1-0/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-23Cygwin: unlink_nt: clean up debug output and commentCorinna Vinschen1-12/+9
The debug statement supposed to be printed when deleting with POSIX semantics failed with STATUS_CANNOT_DELETE or STATUS_INVALID_PARAMETER is in the wrong spot. While at it, simplify the related comment. Fixes: 9fa22dba558f ("Cygwin: unlink: allow fallback from POSIX to default method") Fixes: 527dd1b407e7 ("Cygwin: fix unlink in container") Fixes: 87ab6c7b26bf ("Cygwin: log disabling posix semantics") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-24Cygwin: Drop const qualifier from 2nd argument of tcgetwinsize()Takashi Yano2-2/+2
Fixes: 0eef1b6c9684 ("Cygwin: Add new APIs tc[gs]etwinsize()") Reported-by: Alexander Kleinsorge <aleks@physik.tu-berlin.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-01-24Cygwin: Add new APIs tc[gs]etwinsize()Takashi Yano7-0/+34
New APIs tcgetwinsize/tcsetwinsize are added, which is added in POSIX.1-2024. Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-01-23devctl.h: update for POSIX-1.2024Corinna Vinschen1-16/+0
posix_devctl is now part of POSIX-1.2024, thus the requirement to define _POSIX_26_C_SOURCE has been dropped. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-23Cygwin: Minor updates to load average calculationsMark Geisert2-14/+39
Commentary wording now refers to tasks (i.e., threads) rather than processes. This makes it somewhat easier to justify adding two kinds of counters together. After researching what "load average" has meant over time, we have what seems like a reasonable implementation, modulo Windows differences to Linux. The best resource I found is: https://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html At end of load_init(), obtain and discard the first measure of the counters to deal with the first call always returning error, no data. Follow this with a specific short delay so the next measure actually has data to report. At least one older version of Windows, i.e. Win10 Pro 21H1, has a different name/location for the '% Processor Time' counter and is missing the 'Processor Queue Length' counter entirely. Code is changed to support both possible locations of the former and treat the missing latter as always reporting 0.0. A release note is added for 3.5.6. Reported-by: Mark Liam Brown <brownmarkliam@gmail.com> Addresses: https://cygwin.com/pipermail/cygwin/2024-August/256361.html Signed-off-by: Mark Geisert <mark@maxrnd.com> Fixes: 4dc982ddf60b (Cygwin: loadavg: improve debugging of load_init)
2025-01-22Cygwin: mmap: use 64K pages for bookkeeping, second attemptKen Brown1-18/+36
This reinstates with one change commit 74017d229d5e ("Cygwin: mmap: use 64K pages for bookkeeping"), which was reverted in commit fd57eea5617a. The change is that in mmap_record::match, we now align the record length to the 4K Windows page boundary rather than the 64K Windows allocation granularity. The reason for this is explained in an extensive comment in the code. Addresses: https://cygwin.com/pipermail/cygwin-patches/2025q1/013240.html Fixes: 74017d229d5e ("Cygwin: mmap: use 64K pages for bookkeeping") Signed-off-by: Ken Brown <kbrown@cornell.edu>
2025-01-22Cygwin: signal: Avoid frequent TLS lock/unlock for SIGCONT processingTakashi Yano2-25/+15
It seems that current _cygtls::handle_SIGCONT() code sometimes falls into a deadlock due to frequent TLS lock/unlock operation in the yield() loop. With this patch, the yield() in the wait loop is placed outside the TLS lock to avoid frequent TLS lock/unlock. Fixes: 9ae51bcc51a7 ("Cygwin: signal: Fix another deadlock between main and sig thread") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-01-22Cygwin: Document hang fixs introduced in 3.5.5Takashi Yano1-0/+6
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-01-21Cygwin: unlink: fix error checking orderCorinna Vinschen1-5/+6
Checking EPERM only makes sense if the file exists, so let the EEXIST check change places with the EPERM check. Add a debug statement to the EPERM condition. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-21Cygwin: path_conv: simplify, rearrange, rename combined device checksCorinna Vinschen3-10/+21
Some checks in path_conv are checking for various properties to generate a boolean value, mostly to indicate different combinations of on-disk files and devices. Simplify these checks and, especially, document them inline. Drop the isdevice() check in favor of a new isondisk() check. Fixes: 4fc922b2c8a5 ("Cygwin: POSIX msg queues: Convert mqd_t to a descriptor") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-21Cygwin: path_conv: set on-disk-device flag for message queue filesCorinna Vinschen1-1/+4
This simplifies further checks for on-disk-devices in places with special handling for such files. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>