diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-01-31 10:28:55 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-01-31 10:28:55 +0000 |
commit | 4f27e288c55cd54a2759a59d06a52ed44dac494b (patch) | |
tree | e2f6752ee7c755d7dd29612c439c2a13d4d88338 /winsup/cygwin/cygheap.h | |
parent | d0ae095b8cebb70f5c73783e816fc41779902913 (diff) | |
download | cygnal-4f27e288c55cd54a2759a59d06a52ed44dac494b.tar.gz cygnal-4f27e288c55cd54a2759a59d06a52ed44dac494b.tar.bz2 cygnal-4f27e288c55cd54a2759a59d06a52ed44dac494b.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/cygheap.h')
-rw-r--r-- | winsup/cygwin/cygheap.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index d3baae329..43723244d 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -384,6 +384,29 @@ class cygheap_fdget : public cygheap_fdmanip } }; +class cygheap_fdenum : public cygheap_fdmanip +{ + int start_fd; + public: + cygheap_fdenum (int start_fd = -1, bool lockit = false) + { + if (lockit) + cygheap->fdtab.lock (); + this->start_fd = fd = start_fd < 0 ? -1 : start_fd; + } + int next () + { + while (++fd < (int) cygheap->fdtab.size) + if (*(fh = cygheap->fdtab + fd) != NULL) + return fd; + return -1; + } + void rewind () + { + fd = start_fd; + } +}; + class child_info; void *__stdcall cygheap_setup_for_child (child_info *ci, bool dup_later) __attribute__ ((regparm(2))); void __stdcall cygheap_setup_for_child_cleanup (void *, child_info *, bool) __attribute__ ((regparm(3))); |