Commit Graph

9 Commits

Author SHA1 Message Date
Takashi Yano a9c661a94d Cygwin: [gs]et_io_handle(): renamed to [gs]et_handle().
- Unify get_io_handle() and get_handle() to get_handle().
  Both of them returned same value; io_handle.
- Rename set_io_handle() to set_handle().
2019-03-30 20:08:36 +01:00
Corinna Vinschen 5628399c84 Cygwin: proc fd: fix handling of pipes, sockets, etc
The symlink target of /proc/PID/fd files pointing to pipes and
sockets are just artificial filenames referencing the object using
some internal number.  The pipe open code expects a path specifying
process pid and the internal number so it access the right process
and pipe.

- Set the posix path of the pipe to the simple pipe name only,
  as it shows up in /proc/PID/fd.  A /proc/self prefix is just
  as wrong as a /dev/fd prefix.

- Revert thinko in fhandler_pipe::open expecting the name as
  /proc/self/fd/...  In fact this should never happen.

- Fix up the path before re-opening the pipe instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-05 15:32:08 +01:00
Corinna Vinschen b59f5795e6 Cygwin: proc fd: fix a copy/paste bug calling file_pathconv
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-05 15:20:50 +01:00
Corinna Vinschen 1f6340aa8b Cygwin: proc fd: pass along open mode when reopening file
The reopen code neglected to pass along the requested open
mode correctly.  This may end up reopening the file with
incorrect access mask, or duplicating the wrong pipe handle.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-05 15:20:13 +01:00
Corinna Vinschen 8ae26f96ae Cygwin: proc fd: return EACCES for HANDLE-less fds
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13 23:09:48 +01:00
Corinna Vinschen 9ba65ab8b5 Cygwin: fhandler_process_fd: Fix spacing
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-08 21:47:28 +01:00
Corinna Vinschen 4c33add5b8 Cygwin: drop redundant includes from fhandler_process_fd.cc
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06 22:40:17 +01:00
Corinna Vinschen 9dae73edb8 Cygwin: fix regression in O_TMPFILE | O_EXCL case
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-06 22:39:45 +01:00
Corinna Vinschen 7aca27b4fe Cygwin: introduce fhandler_process_fd and add stat(2) handling
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-06 20:30:14 +01:00