* cygheap.h (class cygheap_fdenum): New class to enumerate used
fhandlers. * dtable.h (class dtable): Add cygheap_fdenum as friend class. * fhandler.h (fhandler_base::get_proc_fd_name): New virtual method to return a name for /proc/<pid>/fd. (fhandler_socket::get_proc_fd_name): Ditto. (fhandler_pipe::get_proc_fd_name): Ditto. (fhandler_virtual::opendir): Make virtual method. (fhandler_process::opendir): New method. * fhandler.cc (fhandler_base::get_proc_fd_name): New method. * fhandler_process.cc: Include ctype.h. (PROCESS_FD): Define. (process_listing): Add "fd". (fhandler_process::exists): Fix comment. Return 1 in case of "fd" directory. Handle files below "fd". (fhandler_process::fstat): Drop "self" handling. Set correct link count for directories. (fhandler_process::opendir): New method to handle "fd" directory. (fhandler_process::readdir): Add "fd" handling. (fhandler_process::open): Drop "self" handling. (fhandler_process::fill_filebuf): Ditto. Add "fd" handling. Fix "maps" output string. * fhandler_registry.cc (fhandler_registry::fstat): Set correct link count for directories. * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): New method. * path.cc (symlink_info::set): Fix thinko. * pinfo.cc (_pinfo::commune_recv): Rename pathbuf to path throughout. Drop local path variable in PICOM_FIFO case. Fix debug output. Close handles as early as possible. Add PICOM_FDS and PICOM_FD handling. (_pinfo::commune_send): Add PICOM_FDS and PICOM_FD handling. (_pinfo::fd): New method. (_pinfo::fds): New method. * pinfo.h (enum picom): Add PICOM_FDS and PICOM_FD. (_pinfo::fd): Declare. (_pinfo::fds): Declare. * pipe.cc (fhandler_pipe::get_proc_fd_name): New method.
This commit is contained in:
@ -218,6 +218,8 @@ class fhandler_base
|
||||
const char *get_name () const { return pc.normalized_path; }
|
||||
const char *get_win32_name () { return pc.get_win32 (); }
|
||||
__ino64_t get_namehash () { return namehash ?: namehash = hash_path_name (0, get_win32_name ()); }
|
||||
/* Returns name used for /proc/<pid>/fd in buf. */
|
||||
virtual char *get_proc_fd_name (char *buf);
|
||||
|
||||
virtual void hclose (HANDLE h) {CloseHandle (h);}
|
||||
virtual void set_no_inheritance (HANDLE &h, int not_inheriting);
|
||||
@ -398,6 +400,7 @@ class fhandler_socket: public fhandler_base
|
||||
void fixup_after_fork (HANDLE);
|
||||
void fixup_after_exec ();
|
||||
bool need_fixup_before () const {return true;}
|
||||
char *get_proc_fd_name (char *buf);
|
||||
|
||||
select_record *select_read (select_record *s);
|
||||
select_record *select_write (select_record *s);
|
||||
@ -432,6 +435,7 @@ public:
|
||||
select_record *select_read (select_record *s);
|
||||
select_record *select_write (select_record *s);
|
||||
select_record *select_except (select_record *s);
|
||||
char *get_proc_fd_name (char *buf);
|
||||
void set_close_on_exec (bool val);
|
||||
void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
|
||||
int close ();
|
||||
@ -1105,7 +1109,7 @@ class fhandler_virtual : public fhandler_base
|
||||
virtual ~fhandler_virtual();
|
||||
|
||||
virtual int exists();
|
||||
DIR *opendir ();
|
||||
virtual DIR *opendir ();
|
||||
_off64_t telldir (DIR *);
|
||||
void seekdir (DIR *, _off64_t);
|
||||
void rewinddir (DIR *);
|
||||
@ -1164,6 +1168,7 @@ class fhandler_process: public fhandler_proc
|
||||
public:
|
||||
fhandler_process ();
|
||||
int exists();
|
||||
DIR *opendir ();
|
||||
struct dirent *readdir (DIR *);
|
||||
int open (int flags, mode_t mode = 0);
|
||||
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
||||
|
Reference in New Issue
Block a user