aboutsummaryrefslogtreecommitdiff
path: root/winsup
AgeCommit message (Collapse)AuthorFilesLines
2024-01-19Cygwin: remove warnings from testsuite buildCorinna Vinschen3-8/+4
- drop unused variable - remove deprectated usage of std::pointer_to_unary_function. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-18Cygwin: replace all `fgrep' with `grep -F'Corinna Vinschen5-8/+8
Unfortunately fgrep is now deprecated in a very pushy way. Make sure to use grep -F instead all around, even in docs and comments/ Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-17Cygwin: copy doc changes from commit 241b50a7abe2 to release notesCorinna Vinschen1-4/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-16Cygwin: Update documentation for cygwin_stackdumpJon Turney1-0/+4
2024-01-16Cygwin: Treat api_fatal() similarly to a core-dumping signalJon Turney3-5/+20
Provide the same debugging opportunities for api_fatal() as we do for a core-dumping signal: 1) Break into any attached debugger 2) Start JIT debugger (if configured) (keeping these under DEBUGGING doesn't seem helpful) 3) Write a coredump (if rlim_core > 1MB) 4) Write a stackdump (if that failed, or 0 < rlim_core <= 1MB)
2024-01-16Cygwin: Define and use __WCOREFLAGJon Turney2-3/+4
Also fix a typo in description of exit status
2024-01-16Cygwin: Disable writing core dumps by default.Jon Turney3-1/+10
Change the default core limit from unlimited to 0 (disabled)
2024-01-16Cygwin: Make 'ulimit -c' control writing a coredumpJon Turney7-41/+143
Pre-format a command to be executed on a fatal error to run 'dumper' (using an absolute path). Factor out executing a pre-formatted command, so we can use that for invoking the JIT debugger in try_to_debug() (if error_start is present in the CYGWIN env var) and to invoke dumper when a fatal error occurs. On a fatal error, if the core file size limit is greater than 1MB, invoke dumper to write a core dump. Otherwise, if that limit is greater than 0, write a .stackdump file, as previously. Adjust and clarify the associated documentation. Also: Fix so that the error_start JIT debugger is now invoked, even when ulimit -c is zero. Also: Fix uses of console_printf() inside exec_prepared_command(). It's output is written via the Windows console device, so needs to use Windows-style line endings. Also: consistently return non-zero from try_to_debug() if we debugged. Future work: Truncate or remove the file written, if it exceeds the maximum size set by the ulimit. Future work: Using the words "fatal error" could probably be improved on. This means exiting on one of the "certain signals whose default action is to cause the process to terminate and produce a core dump file".
2024-01-15Cygwin: introduce close_range(2)Christian Franke6-1/+56
This function closes or sets the close-on-exec flag for a specified range of file descriptors. It is available on FreeBSD and Linux. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-01-15Cygwin: api docs: add missing fallocateCorinna Vinschen1-0/+9
Also add notes in terms of fallocate quirks. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-12Cygwin: Clarifications in 3.5 changes docJon Turney1-4/+4
2024-01-11Cygwin: path.cc: fix comment starting with // but ending in */Corinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-10Cygwin: Fix a stray '\n' in cygcheck manpageJon Turney1-1/+1
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-01-08Cygwin: check remote drives for being SSDs as wellCorinna Vinschen1-1/+1
This enables automatic sparse file support for remote SSDs. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-05Cygwin: fallocate(2): fix debug outputCorinna Vinschen1-1/+1
Fixes: e01c50c7b0a6 ("Cygwin: introduce fallocate(2)") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-05Cygwin: fallocate(2): fix offset and length sanity checkCorinna Vinschen1-1/+3
- len must not be <= 0 - offset + len must not exceed off_t (max. file size) Fixes: e01c50c7b0a6 ("Cygwin: introduce fallocate(2)") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-05Cygwin: posix_fallocate(3): fix offset and length sanity checkCorinna Vinschen1-1/+3
- len must not be <= 0 - offset + len must not exceed off_t (max. file size) Fixes: 7636b5859062 ("* autoload.cc (NtSetInformationFile): Define.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-04Cygwin: fallocate(2): drop useless zeroing pointerCorinna Vinschen1-3/+1
The out pointer is only used if data_chunk_count is > 0, so there's no reason to set it to NULL in the error case. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-01Cygwin: drop stray fs_info::check_ssd declarationCorinna Vinschen1-2/+0
This is just a leftover from development Fixes: 8b01c5d6903f ("Cygwin: fs_info: check for SSD") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30Cygwin: doc: add missing change to posix_spawnpCorinna Vinschen1-0/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30Cygwin: sparse support: enable automatic sparsifying of files on SSDsCorinna Vinschen4-2/+11
Given that SSDs don't have a seek penalty, we can enable automatic sparsifying of files on SSDs, even if the "sparse" mount option is not set. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30Cygwin: fs_info: check for SSDCorinna Vinschen2-0/+18
During fs_info::update, check for the file being on an SSD. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30Cygwin: ntdll.h: add missing NtQueryVolumeInformationFile definitionsCorinna Vinschen1-0/+27
In preparation of using the FileFsSectorSizeInformation info class, add a couple of missing definitions. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30Cygwin: ntdll.h: add missing POBJECT_NAME_INFORMATIONCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30Cygwin: revert autoloading of DiscardVirtualMemoryCorinna Vinschen1-0/+1
Commit a3ae2a734892 ("Cygwin: don't autoload some kernel32 functions") erroneously removed DiscardVirtualMemory from the list of autloaded functions. DiscardVirtualMemory is not available on Windows 8.1. Fixes: a3ae2a734892 ("Cygwin: don't autoload some kernel32 functions") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-29Cygwin: Add '--names-only' flag to cygcheckJon Turney3-15/+31
Add '--names-only' flag to cygcheck, to output just the bare package names.
2023-11-28Cygwin: fallocate(2): handle FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGECorinna Vinschen5-68/+302
Split fhandler_disk_file::fallocate into multiple methods, each implementing a different aspect of fallocate(2), thus adding FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE handling. For more correctly implementing posix_fallocate(3) semantics, make sure to re-allocate holes in the given range if the file is sparse. While at it, change the way checking when to make a file sparse. The rule is now, make file sparse if the hole created by the action spans at least one sparse block, taking the allocation granularity of sparse files into account. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: pwrite(2): sparsify fileCorinna Vinschen1-0/+20
write(2) sparsifies a file after an lseek far enough beyond EOF. Let pwrite(2) sparsify as well if offset is far enough beyond EOF. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: fallocate(2): fix evaluating return valueCorinna Vinschen1-1/+6
fallocate is not supposed to return an errno code, it has to return -1 and set errno. Fixes: dd90ede40510 ("Cygwin: introduce fallocate(2)") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: open(2): reset sparseness on O_TRUNCated filesCorinna Vinschen2-0/+12
open(2) implements O_TRUNC by just reducing the size of the file to 0, to make sure EAs stay available. Turns out, file sparseness is not removed this way either, so add code to do just that. Fixes: 603ef545bdbd ("* fhandler.cc (fhandler_base::open): Never open files with FILE_OVERWITE/FILE_OVERWRITE_IF.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: introduce fallocate(2)Corinna Vinschen7-7/+92
First cut of the new, Linux-specific fallocate(2) function. Do not add any functionality yet, except of basic handling of FALLOC_FL_KEEP_SIZE. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: fcntl.h: Use cdefs.h macrosCorinna Vinschen1-6/+5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: fhandler: rename ftruncate method to fallocateCorinna Vinschen6-16/+21
also, take mode flags parameter instead of just a bool. Introduce __FALLOC_FL_TRUNCATE mode flag as internal flag to indictae being called from ftruncate(2). This is in preparation of an upcoming change introducing the Linx-specific fallocate(2) call. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: posix_fallocate: return ENODEVCorinna Vinschen3-1/+8
The fhandler method ftruncate returns either EISDIR if it has been called on directories, or EINVAL if called on files other than regular files. This matches what ftruncate(2) is supposed to return, but it doesn't match posix_fallocate(3), which is supposed to return ENODEV in both cases. To accomplish that, return ENODEV from fhandler_base::ftruncate() and convert it to EINVAL in ftruncate(2). In posix_fallocate(3), convert EISDIR to ENODEV. Fixes: 7636b58590621 ("* autoload.cc (NtSetInformationFile): Define.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-25Cygwin: lseek: check for file sparseness, not for mount point sparsenessCorinna Vinschen1-1/+1
The code introducing the lseek(2) code for the GNU extensions SEEK_DATA and SEEK_HOLE accidentally checks if the mount point has the "sparse" flag set and, if not, emulates SEEK_DATA/SEEK_HOLE per the Linux specs. However, the mount point "sparse" flag only determines whether files should be made sparse or not. Files may be sparse independently of that, obviously. Fix that by checking for the FILE_ATTRIBUTE_SPARSE_FILE attribute instead. Fixes: edfa581d3c5a ("Cygwin: lseek: implement SEEK_DATA and SEEK_HOLE for files") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-21Cygwin: /dev/disk: Append '#N' if the same name appears more than onceChristian Franke1-21/+33
No longer drop ranges of identical link names. Append '#0, #1, ...' to each name instead. Enhance charset allowed in label names. No longer ignore null volume serial numbers. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-11-20Cygwin: /dev/disk/by-uuid: Fix NTFS serial number print formatChristian Franke1-1/+1
Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-11-17Cygwin: Document /dev/disk/by-* subdirectoriesChristian Franke2-14/+22
Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-11-17Cygwin: Add /dev/disk/by-label and /dev/disk/by-uuid symlinksChristian Franke2-21/+141
The new directories '/dev/disk/by-label' and '/dev/disk/by-uuid' provide symlinks for each disk related volume label and serial number: 'VOLUME_LABEL' -> '../../sdXN' 'VOLUME_SERIAL' -> '../../sdXN' Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-11-17Cygwin: Add /dev/disk/by-drive and /dev/disk/by-voluuid symlinksChristian Franke2-20/+126
The new directory '/dev/disk/by-drive' provides symlinks for each disk related drive letter: 'x' -> '../../sdXN' The new directory '/dev/disk/by-voluuid' provides symlinks for each disk related storage volume: 'MBR_SERIAL-OFFSET' -> '../../sdXN' 'VOLUME_GUID' -> '../../sdXN' Both directories provide Windows specific information and do not exist on Linux. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-11-14Cygwin: rand(3): implement in terms of random(3)Corinna Vinschen2-0/+11
This makes rand(3) ISO C compliant and adds locking to avoid race conditions. Reported-by: Bruno Haible <bruno@clisp.org> Fixes: 8a0efa53e4491 ("import newlib-2000-02-17 snapshot") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-14Fix profiler error() definition and usageMark Geisert3-25/+32
Minor updates to profiler and gmondump, which share some code: - fix operation of error() so it actually works as intended - resize 4K-size auto buffer reservations to BUFSIZ (==1K) - remove trailing '\n' from 2nd arg on error() calls everywhere - provide consistent annotation of Windows error number displays Fixes: 9887fb27f6126 ("Cygwin: New tool: profiler") Fixes: 087a3d76d7335 ("Cygwin: New tool: gmondump") Signed-off-by: Mark Geisert <mark@maxrnd.com>
2023-11-13Add release text for random(3) fixCorinna Vinschen1-0/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-13Cygwin: random: drop unused function srandomdev()Corinna Vinschen1-45/+0
Also drop includes only required for srandomdev(). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-13Cygwin: random: make random(3) functions thread-safeCorinna Vinschen1-6/+41
Add locking to the random(3) family of functions to gain thread-safety per POSIX. Use NetBSD version of the file as role-model. Reported-by: Bruno Haible <bruno@clisp.org> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-08Cygwin: /dev/disk/by-id: Remove leading spaces from identify fieldsChristian Franke1-14/+20
Various drives align the serial number to the right of the fixed length field. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-11-07Cygwin: Document /dev/disk/by-id and /dev/disk/by-partuuidChristian Franke2-0/+20
Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-11-07Cygwin: Add /dev/disk/by-partuuid symlinksChristian Franke2-55/+125
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-05Cygwin: Add /dev/disk/by-id symlinksChristian Franke8-708/+1417
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-10-31Cygwin: let feraiseexcept actually raise an exceptionCorinna Vinschen2-1/+4
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: 0f81b5d4bcaa ("* Makefile.in (DLL_OFILES): Add new fenv.o module.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>