Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-02-01 18:11:47 +0300
committerCorinna Vinschen <corinna@vinschen.de>2005-02-01 18:11:47 +0300
commite8309efda5499f88eb950ff652acdd3a6b07d678 (patch)
treef1799405b3d3a841422f773c89c9d45538d83392 /winsup/cygwin/fhandler_process.cc
parentd93998b17a4c7f07925ecdd48a9474864ba47aea (diff)
* 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/<pid>/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.
Diffstat (limited to 'winsup/cygwin/fhandler_process.cc')
-rw-r--r--winsup/cygwin/fhandler_process.cc32
1 files changed, 29 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index fee65076f..565755cc1 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -92,7 +92,8 @@ static bool get_mem_values (DWORD dwProcessId, unsigned long *vmsize,
unsigned long *vmshare);
/* Returns 0 if path doesn't exist, >0 if path is a directory,
- * -1 if path is a file, -2 if path is a symlink.
+ * -1 if path is a file, -2 if path is a symlink, -3 if path is a pipe,
+ * -4 if path is a socket.
*/
int
fhandler_process::exists ()
@@ -116,6 +117,15 @@ fhandler_process::exists ()
fileid = PROCESS_FD;
if (fill_filebuf ())
return -2;
+ /* Check for nameless device entries. */
+ path = strrchr (path, '/');
+ if (path && *++path)
+ {
+ if (!strncmp (path, "pipe:[", 6))
+ return -3;
+ else if (!strncmp (path, "socket:[", 8))
+ return -4;
+ }
}
return 0;
}
@@ -165,6 +175,16 @@ fhandler_process::fstat (struct __stat64 *buf)
buf->st_gid = p->gid;
buf->st_mode = S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO;
return 0;
+ case -3:
+ buf->st_uid = p->uid;
+ buf->st_gid = p->gid;
+ buf->st_mode = S_IFIFO | S_IRUSR | S_IWUSR;
+ return 0;
+ case -4:
+ buf->st_uid = p->uid;
+ buf->st_gid = p->gid;
+ buf->st_mode = S_IFSOCK | S_IRUSR | S_IWUSR;
+ return 0;
case -1:
default:
buf->st_uid = p->uid;
@@ -269,6 +289,12 @@ fhandler_process::open (int flags, mode_t mode)
goto out;
}
}
+ if (process_file_no == PROCESS_FD)
+ {
+ set_errno (EISDIR);
+ res = 0;
+ goto out;
+ }
if (flags & O_WRONLY)
{
set_errno (EROFS);
@@ -338,8 +364,8 @@ fhandler_process::fill_filebuf ()
filebuf = p->fd (fd, fs);
if (!filebuf || !*filebuf)
{
- filebuf = strdup ("<disconnected>");
- fs = strlen (filebuf) + 1;
+ set_errno (ENOENT);
+ return false;
}
}
filesize = fs;