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:
@ -331,6 +331,7 @@ class fhandler_base
|
||||
int open_with_arch (int, mode_t = 0);
|
||||
int open_null (int flags);
|
||||
virtual int open (int, mode_t);
|
||||
virtual fhandler_base *fd_reopen (int);
|
||||
virtual void open_setup (int flags);
|
||||
void set_unique_id (int64_t u) { unique_id = u; }
|
||||
void set_unique_id () { NtAllocateLocallyUniqueId ((PLUID) &unique_id); }
|
||||
@ -2553,6 +2554,7 @@ class fhandler_process: public fhandler_proc
|
||||
int closedir (DIR *);
|
||||
int __reg3 readdir (DIR *, dirent *);
|
||||
int open (int flags, mode_t mode = 0);
|
||||
virtual fhandler_base *fd_reopen (int);
|
||||
int __reg2 fstat (struct stat *buf);
|
||||
bool fill_filebuf ();
|
||||
|
||||
|
Reference in New Issue
Block a user