* 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.
This commit is contained in:
Corinna Vinschen
2005-02-01 15:11:47 +00:00
parent d93998b17a
commit e8309efda5
9 changed files with 103 additions and 34 deletions

View File

@ -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/<pid>/symlinks */
case -3: /* /proc/self */
case -2: /* /proc/self or /proc/<pid>/symlinks */
goto is_virtual_symlink;
case -3: /* /proc/<pid>/fd/pipe:[] */
fileattr = 0;
dev.parse (FH_PIPE);
break;
case -4: /* /proc/<pid>/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;