Cygwin: implement /proc/PID/fd/DESCRIPTOR reopening by handle

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>
This commit is contained in:
Corinna Vinschen
2019-01-05 22:13:42 +01:00
parent c76468182b
commit 732613f30a
6 changed files with 108 additions and 5 deletions

View File

@ -47,10 +47,12 @@ enum pathconv_arg
PC_SYM_CONTENTS = 0x0008,
PC_NOFULL = 0x0010,
PC_NULLEMPTY = 0x0020,
PC_DO_NOT_USE = 0x0040,
PC_POSIX = 0x0080,
PC_NOWARN = 0x0100,
PC_OPEN = 0x0200, /* use open semantics */
PC_CTTY = 0x0400, /* could later be used as ctty */
PC_SYM_NOFOLLOW_PROCFD = 0x0800,
PC_KEEP_HANDLE = 0x00400000,
PC_NO_ACCESS_CHECK = 0x00800000
};