diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-01-11 12:35:41 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-01-11 12:35:41 +0100 |
commit | a10d96923188977446ebd84323b47f7085fb5cb4 (patch) | |
tree | 93f0d80084bd2b86e83f98e2d96cbed00045fafb /winsup/cygwin/pinfo.cc | |
parent | 20ddde2f552afedf7ef662bb21fec7a56f50040f (diff) | |
download | newlib-a10d96923188977446ebd84323b47f7085fb5cb4.zip newlib-a10d96923188977446ebd84323b47f7085fb5cb4.tar.gz newlib-a10d96923188977446ebd84323b47f7085fb5cb4.tar.bz2 |
Return unique inode numbers when calling stat/fstat on pipes and IP sockets
* fhandler.h (class fhandler_base): Convert unique_id to int64_t.
(fhandler_base::set_ino): New protected inline method.
(fhandler_base::get_unique_id): Convert to int64_t.
(fhandler_base::set_unique_id): New inline method taking int64_t.
(fhandler_pipe::fstat): Declare.
(fhandler_pipe::init): Take extra parameter.
(fhandler_pipe::create): Ditto.
* fhandler_socket.cc (fhandler_socket::init_events): Set inode number
to serial number.
(fhandler_socket::fstat): Set device to DEV_TCP_MAJOR. Create st_ino
from get_ino.
* include/cygwin/signal.h (struct _sigcommune): Replace
_si_pipe_fhandler with _si_pipe_unique_id.
* pinfo.h (_pinfo::pipe_fhandler): Take unique id instead of HANDLE.
* pinfo.cc (commune_process): Accommodate change to _si_pipe_unique_id.
(_pinfo::commune_request): Ditto.
(_pinfo::pipe_fhandler): Ditto.
* pipe.cc (fhandler_pipe::init): Take unique id as argument and set
inode number and unique_id from there.
(fhandler_pipe::open): Rework to find any matching pipe from unique
id in filename.
(fhandler_pipe::get_proc_fd_name): Create filename using inode number.
(fhandler_pipe::create): Generate and return unique id from process pid
and pipe_unique_id. In outer method, call init with additional unique
id as parameter.
(fhandler_pipe::fstat): New method.
(pipe_worker): Accommodate using 64 bit inode number in filename.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r-- | winsup/cygwin/pinfo.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index d0b4cd9..be32cfd 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -622,11 +622,11 @@ commune_process (void *arg) case PICOM_PIPE_FHANDLER: { sigproc_printf ("processing PICOM_FDS"); - HANDLE hdl = si._si_commune._si_pipe_fhandler; + int64_t unique_id = si._si_commune._si_pipe_unique_id; unsigned int n = 0; cygheap_fdenum cfd; while (cfd.next () >= 0) - if (cfd->get_handle () == hdl) + if (cfd->get_unique_id () == unique_id) { fhandler_pipe *fh = cfd; n = sizeof *fh; @@ -701,7 +701,7 @@ _pinfo::commune_request (__uint32_t code, ...) switch (code) { case PICOM_PIPE_FHANDLER: - si._si_commune._si_pipe_fhandler = va_arg (args, HANDLE); + si._si_commune._si_pipe_unique_id = va_arg (args, int64_t); break; case PICOM_FD: @@ -781,13 +781,13 @@ out: } fhandler_pipe * -_pinfo::pipe_fhandler (HANDLE hdl, size_t &n) +_pinfo::pipe_fhandler (int64_t unique_id, size_t &n) { if (!this || !pid) return NULL; if (pid == myself->pid) return NULL; - commune_result cr = commune_request (PICOM_PIPE_FHANDLER, hdl); + commune_result cr = commune_request (PICOM_PIPE_FHANDLER, unique_id); n = cr.n; return (fhandler_pipe *) cr.s; } |