* Makefile.in (DLL_OFILES): Add fhandler_procsys.o.
* devices.h (enum fh_devices): Add FH_PROCSYS. * devices.in (dev_procsys_storage): New device. * devices.cc: Regenerate. * dtable.cc (build_fh_pc): Add code to allocate fhandler_procsys. * fhandler.h (proc_len): Convert to size_t. (procsys): Declare. (procsys_len): Declare. (enum virtual_ftype_t): Move here from fhandler_virtual.h. Add members supported by fhandler_procsys. (fhandler_virtual::exists): Return virtual_ftype_t. Change in all derived classes. (class fhandler_procsys): New class. (fhandler_union): Add fhandler_procnet and fhandler_procsys members. * fhandler_disk_file.cc (__DIR_mounts::check_missing_mount): Use ro_u_proc. (fhandler_base::fstat_by_handle): Don't copy attributes if file is an NT device. (fhandler_base::fstat_by_name): Ditto. * fhandler_netdrive.cc (fhandler_netdrive::exists): Return virtual_ftype_t. * fhandler_proc.cc (proc_tab): Sort alphabetically. Use _VN macro to store length. (proc_len): Change to size_t. (proc_tab_cmp): New static function. (virt_tab_search): New function to search entry in virt_tab_t arrays. Use throughout in /proc and sibling classes instead of loop. (fhandler_proc::exists): Return virtual_ftype_t. * fhandler_process.cc (process_tab): Sort alphabetically. Use _VN macro to store length. (fhandler_process::exists): Return virtual_ftype_t. (fhandler_process::open): Simplify code. * fhandler_procnet.cc (procnet_tab): Sort alphabetically. Use _VN macro to store length. (fhandler_procnet::exists): Return virtual_ftype_t. (fhandler_procnet::open): Simplify. * fhandler_procsys.cc: New file. * fhandler_registry.cc (fhandler_registry::exists): Return virtual_ftype_t. * fhandler_virtual.cc (fhandler_virtual::exists): Ditto. * fhandler_virtual.h (enum virtual_ftype_t): Move to fhandler.h. (virt_tab_t): Add name_len member. (_VN): New macro. (virt_tab_search): Declare. * mount.cc (mount_info::conv_to_win32_path): Fix comment. Backslashify isprocsys_dev paths. * ntdll.h (STATUS_OBJECT_TYPE_MISMATCH): Define (STATUS_INSTANCE_NOT_AVAILABLE): Define. (STATUS_PIPE_NOT_AVAILABLE): Define. (STATUS_INVALID_PIPE_STATE): Define. (STATUS_PIPE_BUSY): Define. (SYMBOLIC_LINK_QUERY): Define. (NtOpenSymbolicLinkObject): Declare. (NtQuerySymbolicLinkObject): Declare. * path.cc (path_conv::check): Accommodate fact that exists method returns virtual_ftype_t now. Add cases for new virtual_ftype_t types. (cygwin_conv_path): Add GLOBALROOT prefix to native device paths. Make sure to strip \\?\ prefix only for actual filesystem-based paths, not for all paths. * path.h (isproc_dev): Add FH_PROCSYS. (isprocsys_dev): Define.
This commit is contained in:
@ -34,7 +34,9 @@ extern const char *windows_device_names[];
|
||||
extern struct __cygwin_perfile *perfile_table;
|
||||
#define __fmode (*(user_data->fmode_ptr))
|
||||
extern const char proc[];
|
||||
extern const int proc_len;
|
||||
extern const size_t proc_len;
|
||||
extern const char procsys[];
|
||||
extern const size_t procsys_len;
|
||||
|
||||
class select_record;
|
||||
class select_stuff;
|
||||
@ -99,6 +101,20 @@ enum del_lock_called_from {
|
||||
after_exec
|
||||
};
|
||||
|
||||
enum virtual_ftype_t {
|
||||
virt_blk = -7, /* Block special */
|
||||
virt_chr = -6, /* Character special */
|
||||
virt_fsfile = -5, /* FS-based file via /proc/sys */
|
||||
virt_socket = -4, /* Socket */
|
||||
virt_pipe = -3, /* Pipe */
|
||||
virt_symlink = -2, /* Symlink */
|
||||
virt_file = -1, /* Regular file */
|
||||
virt_none = 0, /* Invalid, Error */
|
||||
virt_directory = 1, /* Directory */
|
||||
virt_rootdir = 2, /* Root directory of virtual FS */
|
||||
virt_fsdir = 3, /* FS-based directory via /proc/sys */
|
||||
};
|
||||
|
||||
class fhandler_base
|
||||
{
|
||||
friend class dtable;
|
||||
@ -1331,7 +1347,7 @@ class fhandler_virtual : public fhandler_base
|
||||
fhandler_virtual ();
|
||||
virtual ~fhandler_virtual();
|
||||
|
||||
virtual int exists();
|
||||
virtual virtual_ftype_t exists();
|
||||
DIR *opendir (int fd) __attribute__ ((regparm (2)));
|
||||
long telldir (DIR *);
|
||||
void seekdir (DIR *, long);
|
||||
@ -1357,7 +1373,7 @@ class fhandler_proc: public fhandler_virtual
|
||||
{
|
||||
public:
|
||||
fhandler_proc ();
|
||||
int exists();
|
||||
virtual_ftype_t exists();
|
||||
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
||||
static DWORD get_proc_fhandler(const char *path);
|
||||
|
||||
@ -1366,11 +1382,30 @@ class fhandler_proc: public fhandler_virtual
|
||||
bool fill_filebuf ();
|
||||
};
|
||||
|
||||
class fhandler_procsys: public fhandler_virtual
|
||||
{
|
||||
public:
|
||||
fhandler_procsys ();
|
||||
virtual_ftype_t exists(struct __stat64 *buf) __attribute__ ((regparm (2)));
|
||||
virtual_ftype_t exists();
|
||||
DIR *opendir (int fd) __attribute__ ((regparm (2)));
|
||||
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
||||
long telldir (DIR *);
|
||||
void seekdir (DIR *, long);
|
||||
int closedir (DIR *);
|
||||
int open (int flags, mode_t mode = 0);
|
||||
int close ();
|
||||
void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3)));
|
||||
ssize_t __stdcall write (const void *ptr, size_t len);
|
||||
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
||||
bool fill_filebuf ();
|
||||
};
|
||||
|
||||
class fhandler_netdrive: public fhandler_virtual
|
||||
{
|
||||
public:
|
||||
fhandler_netdrive ();
|
||||
int exists();
|
||||
virtual_ftype_t exists();
|
||||
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
||||
void seekdir (DIR *, long);
|
||||
void rewinddir (DIR *);
|
||||
@ -1388,7 +1423,7 @@ class fhandler_registry: public fhandler_proc
|
||||
public:
|
||||
fhandler_registry ();
|
||||
void set_name (path_conv &pc);
|
||||
int exists();
|
||||
virtual_ftype_t exists();
|
||||
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
||||
long telldir (DIR *);
|
||||
void seekdir (DIR *, long);
|
||||
@ -1408,7 +1443,7 @@ class fhandler_process: public fhandler_proc
|
||||
pid_t pid;
|
||||
public:
|
||||
fhandler_process ();
|
||||
int exists();
|
||||
virtual_ftype_t exists();
|
||||
DIR *opendir (int fd) __attribute__ ((regparm (2)));
|
||||
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
||||
int open (int flags, mode_t mode = 0);
|
||||
@ -1421,7 +1456,7 @@ class fhandler_procnet: public fhandler_proc
|
||||
pid_t pid;
|
||||
public:
|
||||
fhandler_procnet ();
|
||||
int exists();
|
||||
virtual_ftype_t exists();
|
||||
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
||||
int open (int flags, mode_t mode = 0);
|
||||
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
||||
@ -1462,6 +1497,8 @@ typedef union
|
||||
char __pipe[sizeof (fhandler_pipe)];
|
||||
char __proc[sizeof (fhandler_proc)];
|
||||
char __process[sizeof (fhandler_process)];
|
||||
char __procnet[sizeof (fhandler_procnet)];
|
||||
char __procsys[sizeof (fhandler_procsys)];
|
||||
char __pty_master[sizeof (fhandler_pty_master)];
|
||||
char __registry[sizeof (fhandler_registry)];
|
||||
char __serial[sizeof (fhandler_serial)];
|
||||
|
Reference in New Issue
Block a user