From e8309efda5499f88eb950ff652acdd3a6b07d678 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 1 Feb 2005 15:11:47 +0000 Subject: * fhandler.cc (fhandler_base::get_proc_fd_name): Don't generate "device:" entry. * fhandler.h (fhandler_socket::open): New method. (fhandler_pipe::open): New method. * fhandler_proc.cc (fhandler_proc::exists): Return -2 in case of /proc/self. * fhandler_process.cc (fhandler_process::exists): Return -2 in case of symlinks, -3 for pipes and -4 for sockets. (fhandler_process::fstat): Handle pipes and sockets. (fhandler_process::open): Handle opening /proc//fd. (fhandler_process::fill_filebuf): Generate empty names for non exisiting file descriptors. * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Always generate "socket:[number]" strings as on Linux. (fhandler_socket::open): New method. (fhandler_socket::fstat): Always return socket type. * path.cc (symlink_info::set): Remove unused second parameter. (path_conv::check): Handle pipes and sockets in /proc. Set correct device type for AF_LOCAL sockets. * pinfo.cc (_pinfo::commune_recv): Generate empty names for non exisiting file descriptors. (_pinfo::fd): Ditto. * pipe.cc (fhandler_pipe::open): New method. --- winsup/cygwin/path.cc | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 9705acd1a..9321a9b32 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -95,7 +95,7 @@ struct symlink_info _minor_t minor; _mode_t mode; int check (char *path, const suffix_info *suffixes, unsigned opt); - int set (char *path, int type); + int set (char *path); bool parse_device (const char *); bool case_check (char *path); }; @@ -617,10 +617,10 @@ path_conv::check (const char *src, unsigned opt, /* FIXME: Calling build_fhandler here is not the right way to handle this. */ fhandler_virtual *fh = (fhandler_virtual *) build_fh_dev (dev, path_copy); int file_type = fh->exists (); - if (file_type == -2 || file_type == -3) + if (file_type == -2) { fh->fill_filebuf (); - symlen = sym.set (fh->get_filebuf (), file_type); + symlen = sym.set (fh->get_filebuf ()); } delete fh; switch (file_type) @@ -632,9 +632,16 @@ path_conv::check (const char *src, unsigned opt, case -1: fileattr = 0; break; - case -2: /* /proc//symlinks */ - case -3: /* /proc/self */ + case -2: /* /proc/self or /proc//symlinks */ goto is_virtual_symlink; + case -3: /* /proc//fd/pipe:[] */ + fileattr = 0; + dev.parse (FH_PIPE); + break; + case -4: /* /proc//fd/socket:[] */ + fileattr = 0; + dev.parse (FH_TCP); + break; default: fileattr = INVALID_FILE_ATTRIBUTES; goto virtual_component_retry; @@ -678,7 +685,16 @@ is_virtual_symlink: } if (sym.pflags & PATH_SOCKET) - dev.setfs (1); + { + if (component) + { + error = ENOTDIR; + return; + } + fileattr = 0; + dev.parse (FH_UNIX); + goto out; + } if (sym.case_clash) { @@ -3142,7 +3158,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt) /* "path" is the path in a virtual symlink. Set a symlink_info struct from that and proceed with further path checking afterwards. */ int -symlink_info::set (char *path, int type) +symlink_info::set (char *path) { strcpy (contents, path); pflags = PATH_SYMLINK; -- cgit v1.2.3