aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-01-14Cygwin: wincap: split has_posix_file_infoCorinna Vinschen3-13/+49
While FileRenameInformationEx is defined starting with Windows 10 1709 per MSDN, it only starts working in W10 1809, apparently. Users of 1803 report "Function not implemented". Introduce wincap_10_1809 and change the version check in wincapc::init accordingly. Split has_posix_file_info into has_posix_unlink_semantics and has_posix_rename_semantics. Enable the latter only starting with W10 1809. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-14Cygwin: signalfd: implement non-polling selectCorinna Vinschen9-33/+129
Allow the signal thread to recognize we're called in consequence of select on a signalfd. If the signal is part of the wait mask, don't call any signal handler and don't remove the signal from the queue, so a subsequent read (or sigwaitinfo/sigtimedwait) still gets the signal. Instead, just signal the event object at _cygtls::signalfd_select_wait for the thread running select. The addition of signalfd_select_wait to _cygtls unearthed the alignment problem of the context member again. To make sure this doesn't get lost, improve the related comment in the header file so that this (hopefully) doesn't get lost (again). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-14Cygwin: select: always store the running thread's TLS into select_recordCorinna Vinschen1-1/+3
This allows select threads to access our current tls if required. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13Cygwin: document wctype changesCorinna Vinschen2-0/+9
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13update to Unicode 11.0Thomas Wolff4-93/+159
2019-01-13map WEOF to undefined rather than the control char categoryThomas Wolff1-1/+1
Fixes https://cygwin.com/ml/cygwin/2018-12/msg00173.html
2019-01-13Cygwin: signal: implement signalfdCorinna Vinschen17-4/+397
First cut of a signalfd implementation. Still TODO: Non-polling select. This should mostly work as on Linux except for missing support for some members of struct signalfd_siginfo, namely ssi_fd, ssi_band (both SIGIO/SIGPOLL, not fully implemented) and ssi_trapno (HW exception, required HW support). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13Cygwin: proc fd: return EACCES for HANDLE-less fdsCorinna Vinschen1-0/+7
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13Cygwin: minor cleanupsCorinna Vinschen3-6/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13Cygwin: select: fix overwriting fd sets if poll returns no fdCorinna Vinschen2-6/+11
There's a long-standing bug in select. If we have poll-only descriptors in the fd set, select overwrites the incoming fd sets with the polling result. If none of the fds is ready, select has to loop again. But now the fd sets are set to all zero and select hangs. Fix this by utilizing the local fd sets r, w, e as storage for the incoming fd sets and use them to initialize select_stuff. If we have to loop, overwritung the incoming fd sets doesn't matter. While at it, rename r, w, e to readfds_in, writefds_in, exceptfds_in. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13Cygwin: fhandler_pipe: unify format directivesCorinna Vinschen1-4/+4
The format directives in sscanf/__small_sprintf are not matching. Fix that.
2019-01-12Cygwin: posix timers: implement timer_getoverrunCorinna Vinschen10-13/+159
- set DELAYTIMER_MAX to INT_MAX - make sure to set siginfo_t::si_overrun, as on Linux Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-12Cygwin: posix timers: some cleanupCorinna Vinschen2-12/+12
- use int64_t instead of long long - make is_timer_tracker const - improve copyright header comment Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-12Cygwin: posix timers: convert timer_tracker::fixup_after_fork to static methodCorinna Vinschen2-4/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-12Cygwin: posix timers: move definition of timer_tracker class to new timer.hCorinna Vinschen2-29/+42
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-11Cygwin: clock_nanosleep is not supposed to crash, return EFAULT insteadCorinna Vinschen1-5/+21
...in case rqtp or rmtp specified invalid addresses. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-11Cygwin: timer: convert timer_tracker to a real C++ classCorinna Vinschen1-55/+84
...with private members and all the jazz Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-10Cygwin: af_unix_spinlock_t: add initializerKen Brown1-1/+2
Also fix a typo.
2019-01-09Cygwin: try_to_bin: don't check recycler filename all the timeCorinna Vinschen1-33/+38
So far we check the recycler name all the time, and the last interation also only managed to handle two ways to write the recycler. However, an adventurous user might change the case of the recycler arbitrarily. Fix this problem by keeping track of the name in a somewhat relaxed fashion. Use camel back on drive C by default, all upper case elsewhere. Only if the rename op fails do we fix the recycler name on the fly when trying to create it, and it turns out it already existed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-09Cygwin: try_to_bin: fix rootdir handle after reopeningCorinna Vinschen1-0/+2
If the first rename fails, we reopen the rootdir for creating a subdir. The rootdir handle can change its value at this point, but the code doesn't take this into account. The subsequent rename then fails with STATUS_INVALID_HANDLE. Fix this by copying the new rootdir value to pfri->RootDirectory. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-09Cygwin: rename: use FILE_RENAME_POSIX_SEMANTICS if availableCorinna Vinschen3-4/+36
starting with W10 1709 on local NTFS drives Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-09Cygwin: rename: rename incoming flags argument to at2flagsCorinna Vinschen1-3/+3
Avoid name confusion with later used flags variable Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-08Cygwin: try_to_bin: don't reopen the fileCorinna Vinschen1-25/+30
So far we reopened the file if it was opened case sensitive to workaround the problem that the recycler could be named in camel back or all upper case, depending on who created it. That's a problem for O_TMPFILE on pre-W10. As soon as the original HANDLE gets closed, delete-on-close is converted to full delete disposition and all useful operations on the file cease to work (STATUS_ACCESS_DENIED or STATUS_FILE_DELETED). To avoid that problem drop the reopen code and check for the exact recycler filename, either $Recycle.Bin or $RECYCLE.BIN, if the file has been opened case sensitive. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-08Cygwin: open: workaround reopen file w/ delete disposition setCorinna Vinschen1-0/+17
On pre-W10 systems there's no way to reopen a file by handle if the delete disposition is set. We try to get around with duplicating the handle. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-08Cygwin: open: handle O_CLOEXEC when opening file from handleCorinna Vinschen1-1/+5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-08Cygwin: fhandler_process_fd: Fix spacingCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-08Cygwin: remove unused tmpbuf.hCorinna Vinschen1-25/+0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-07fcntl.h: expose AT_EMPTY_PATH with _GNU_SOURCE onlyCorinna Vinschen1-0/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-07Cygwin: linkat: support Linux-specific AT_EMPTY_PATH flagCorinna Vinschen4-2/+25
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-07Cygwin: open: support Linux-specific O_PATH flagCorinna Vinschen8-4/+74
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-07Cygwin: rename pipe.cc to fhandler_pipe.ccCorinna Vinschen3-71/+71
move pipe syscalls to syscalls.cc Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-07Cygwin: move fhandler_cygdrive methods into own source fileCorinna Vinschen3-137/+159
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: drop redundant includes from fhandler_process_fd.ccCorinna Vinschen1-14/+0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: fix regression in O_TMPFILE | O_EXCL caseCorinna Vinschen6-12/+31
The new proc fd code accidentally allowed to linkat an O_TMPFILE even if the file has been opened with O_EXCL. This patch fixes it. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: document proc fd changesCorinna Vinschen2-0/+13
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: introduce fhandler_process_fd and add stat(2) handlingCorinna Vinschen6-164/+189
move special fd symlink code into own fhandler_process_fd class to simplify further additions to /proc/PID/fd/DESCRIPTOR symlink handling. Add a method to handle stat(2) on such a proc fd symlink by handle. This allows correct reply from stat(2) if the target file has been deleted. This eventually fixes `awk -f /dev/fd/3 3<<eof'. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: path_conv: add PATH_RESOLVE_PROCFD path_types flagCorinna Vinschen3-5/+10
path_conv now sets the PATH_RESOLVE_PROCFD flag in path_flags if the PC_SYM_NOFOLLOW_PROCFD pathconv_arg flag has been set on input *and* the file is actually a proc fd symlink. Add matching path_conv::follow_fd_symlink method for checking and use it in open(2). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: path_conv: decouple path_types from mount typesCorinna Vinschen6-144/+137
- Remove another unfortunate amalgamation: Mount flags (MOUNT_xxx) are converted to path_types (PATH_xxx) and mixed with non-mount path_types flags in the same storage, leading to a tangled, pell-mell usage of mount flags and path flags in path_conv and symlink_info. - There's also the case of PC_NONULLEMPTY. It's used in exactly one place with a path_conv constructor only used in this single place, just to override the automatic PC_NULLEMPTY addition when calling the other path_conv constructors. Crazily, PC_NONULLEMPTY is a define, no path_types flag, despite its name. - It doesn't help that the binary flag exists as mount and path flag, while the text flag only exists as path flag. This leads to mount code using path flags to set text/binary. Very confusing is the fact that a text mount/path flag is not actually required; the mount code sets the text flag on non binary mounts anyway, so there are only two states. However, to puzzle people a bit more, path_conv::binary wrongly implies there's a third, non-binary/non-text state. Clean up this mess: - Store path flags separately from mount flags in path_conv and symlink_info classes and change all checks and testing inline methods accordingly. - Make PC_NONULLEMPTY a simple path_types flag and drop the redundant path_check constructor. - Clean up the definition of pathconv_arg, path_types, and mount flags. Use _BIT expression, newly define in cygwin/bits.h. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: path_conv: decouple pathconv_flags from path_typesCorinna Vinschen2-9/+13
There's an unfortunate amalgamation of caller-provided pathconv_arg flags with path_types flags which in turn are mostly mount flags. This leads to a confusion of flag values in sylink_info::pflags and, in turn, in path_conv::path_flags. This patch decouples pathconv_flags from the other flags by making sure that a pathconv_flag is never copied into a variable used for path_types flags. Also, remove PATH_NO_ACCESS_CHECK since it's not necessary. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: Mark all O_TMPFILEs as deletedCorinna Vinschen1-5/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: Move O_TMPFILE to bin and allow linkat by handleCorinna Vinschen3-1/+90
Along the same lines as the previous patch: By reopening an O_TMPFILE by handle, we can now move the file to the bin at open time and thus free'ing up the parent dir and *still* open the file as /proc/PID/fd/DESCRIPTOR by linkat(2).
2019-01-06Cygwin: try_to_bin: allow to move O_TMPFILE files into binCorinna Vinschen1-26/+33
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: implement /proc/PID/fd/DESCRIPTOR reopening by handleCorinna Vinschen6-5/+108
Allows expressions along the lines of `cat /proc/self/fd/0 <<EOF'. The problem here is that the temporary file used for the here script has already been deleted by the shell. Opening by filename, as implemented so far, doesn't work because the file has been moved to the bin. Allow reopening files by handle the same way from another process as long as we have sufficient permissions on the foreign process. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: pinfo: add method to send a serialized path_conv and HANDLECorinna Vinschen2-2/+38
To allow reopening a file open in another process by HANDLE, introduce a matching file_pathconv method, taking a file descriptor as parameter. The result is a serialized path_conv and a HANDLE value. The HANDLE is valid in the foreign process and MUST be duplicated into the target process before usage. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: path_conv: add serialization/deserialization facilityCorinna Vinschen2-0/+67
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: path_conv: reorder private method declarationsCorinna Vinschen1-3/+5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06Cygwin: fhandler_base::open: allow to reopen file from handleCorinna Vinschen1-1/+6
So far io_handle is NULL when calling fhandler_base::open to open or create a file. Add a check for io_handle to allow priming the fhandler with a HANDLE value so we can reopen a file from a HANDLE on file systems supporting it. This allows to open already deleted files for further action. This will be used by open("/proc/PID/fd/DESCRIPTOR") scenarios. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-05Cygwin: pipe: use /proc/PID/fd/... or /proc/self/fd/... nameCorinna Vinschen1-4/+11
Don't emit /dev/fd/... filename. This simplifies pipe path handling and avoids another symlink redirection. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-05Cygwin: introduce virt_fdsymlink to simplify /proc/PID/fd symlink handlingCorinna Vinschen3-2/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-05Cygwin: return correct FH_PROCESSFD for files under /proc/PID/fd subdirCorinna Vinschen2-3/+11
This allows easier handling of fd symlinks. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>