diff options
Diffstat (limited to 'winsup/cygwin/fhandler.h')
-rw-r--r-- | winsup/cygwin/fhandler.h | 308 |
1 files changed, 154 insertions, 154 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 5ab0ed51d..2ee82fcf9 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -11,9 +11,6 @@ details. */ #ifndef _FHANDLER_H_ #define _FHANDLER_H_ -#include <sys/ioctl.h> -#include <fcntl.h> - enum { FH_RBINARY = 0x00001000, /* binary read mode */ @@ -42,45 +39,9 @@ enum FH_HASACLS = 0x40000000, /* True if fs of file has ACLS */ FH_QUERYOPEN = 0x80000000, /* open file without requesting either read or write access */ - - /* Device flags */ - - /* Slow devices */ - FH_CONSOLE = 0x00000001, /* is a console */ - FH_CONIN = 0x00000002, /* console input */ - FH_CONOUT = 0x00000003, /* console output */ - FH_TTYM = 0x00000004, /* is a tty master */ - FH_TTYS = 0x00000005, /* is a tty slave */ - FH_PTYM = 0x00000006, /* is a pty master */ - FH_SERIAL = 0x00000007, /* is a serial port */ - FH_PIPE = 0x00000008, /* is a pipe */ - FH_PIPER = 0x00000009, /* read end of a pipe */ - FH_PIPEW = 0x0000000a, /* write end of a pipe */ - FH_SOCKET = 0x0000000b, /* is a socket */ - FH_WINDOWS = 0x0000000c, /* is a window */ - FH_SLOW = 0x00000010, /* "slow" device if below this */ - - /* Fast devices */ - FH_DISK = 0x00000010, /* is a disk */ - FH_FLOPPY = 0x00000011, /* is a floppy */ - FH_TAPE = 0x00000012, /* is a tape */ - FH_NULL = 0x00000013, /* is the null device */ - FH_ZERO = 0x00000014, /* is the zero device */ - FH_RANDOM = 0x00000015, /* is a random device */ - FH_MEM = 0x00000016, /* is a mem device */ - FH_CLIPBOARD = 0x00000017, /* is a clipboard device */ - FH_OSS_DSP = 0x00000018, /* is a dsp audio device */ - FH_CYGDRIVE= 0x00000019, /* /cygdrive/x */ - FH_PROC = 0x0000001a, /* /proc */ - FH_REGISTRY =0x0000001b, /* /proc/registry */ - FH_PROCESS = 0x0000001c, /* /proc/<n> */ - - FH_NDEV = 0x0000001d, /* Maximum number of devices */ - FH_DEVMASK = 0x00000fff, /* devices live here */ - FH_BAD = 0xffffffff }; -#define FHDEVN(n) ((n) & FH_DEVMASK) +#define FHDEVN(n) (n) #define FHISSETF(x) __ISSETF (this, x, FH) #define FHSETF(x) __SETF (this, x, FH) #define FHCLEARF(x) __CLEARF (this, x, FH) @@ -112,7 +73,6 @@ extern const char proc[]; extern const int proc_len; class select_record; -class path_conv; class fhandler_disk_file; typedef struct __DIR DIR; struct dirent; @@ -135,16 +95,9 @@ enum bg_check_types bg_signalled = 2 }; -enum executable_states -{ - is_executable, - dont_care_if_executable, - not_executable = dont_care_if_executable, - dont_know_if_executable -}; - class fhandler_base { + friend class dtable; protected: DWORD status; private: @@ -164,27 +117,32 @@ class fhandler_base size_t raixput; size_t rabuflen; - const char *unix_path_name; - const char *win32_path_name; DWORD open_status; DWORD fs_flags; HANDLE read_state; + path_conv pc; public: - bool set_name (const char * unix_path, const char *win32_path = NULL, int unit = 0); + void set_name (path_conv &pc); + int error () const {return pc.error;} + bool exists () const {return pc.exists ();} + int pc_binmode () const {return pc.binmode ();} + device& dev () {return pc.dev;} + operator DWORD& () {return (DWORD) pc;} virtual fhandler_base& operator =(fhandler_base &x); - fhandler_base (DWORD dev, int unit = 0); + fhandler_base (); virtual ~fhandler_base (); /* Non-virtual simple accessor functions. */ void set_io_handle (HANDLE x) { io_handle = x; } - DWORD get_device () { return status & FH_DEVMASK; } - virtual int get_unit () { return 0; } - virtual BOOL is_slow () { return get_device () < FH_SLOW; } + DWORD get_device () { return dev ().devn; } + DWORD get_major () { return dev ().major; } + DWORD get_minor () { return dev ().minor; } + virtual int get_unit () { return dev ().minor; } - int get_access () { return access; } + int get_access () const { return access; } void set_access (int x) { access = x; } bool get_async () { return FHISSETF (ASYNC); } @@ -298,8 +256,8 @@ class fhandler_base bool isremote () { return FHISSETF (ISREMOTE); } void set_isremote (int val) { FHCONDSETF (val, ISREMOTE); } - const char *get_name () { return unix_path_name; } - const char *get_win32_name () { return win32_path_name; } + const char *get_name () const { return pc.normalized_path; } + const char *get_win32_name () { return pc.get_win32 (); } __ino64_t get_namehash () { return namehash; } virtual void hclose (HANDLE h) {CloseHandle (h);} @@ -307,13 +265,29 @@ class fhandler_base /* fixup fd possibly non-inherited handles after fork */ void fork_fixup (HANDLE parent, HANDLE &h, const char *name); + virtual bool need_fixup_before () const {return false;} - virtual int open (path_conv *real_path, int flags, mode_t mode = 0); + virtual int open (int flags, mode_t mode = 0); + int open_fs (int flags, mode_t mode = 0); virtual int close (); - virtual int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); + int close_fs (); + virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); + int __stdcall fstat_fs (struct __stat64 *buf) __attribute__ ((regparm (2))); + int __stdcall fstat_helper (struct __stat64 *buf, + FILETIME ftCreateionTime, + FILETIME ftLastAccessTime, + FILETIME ftLastWriteTime, + DWORD nFileSizeHigh, + DWORD nFileSizeLow, + DWORD nFileIndexHigh = 0, + DWORD nFileIndexLow = 0, + DWORD nNumberOfLinks = 1) + __attribute__ ((regparm (3))); + int __stdcall fstat_by_handle (struct __stat64 *buf) __attribute__ ((regparm (2))); + int __stdcall fstat_by_name (struct __stat64 *buf) __attribute__ ((regparm (2))); virtual int ioctl (unsigned int cmd, void *); virtual int fcntl (int cmd, void *); - virtual char const * ttyname () { return get_name(); } + virtual char const *ttyname () { return get_name(); } virtual void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); virtual int write (const void *ptr, size_t len); virtual ssize_t readv (const struct iovec *, int iovcnt, ssize_t tot = -1); @@ -343,9 +317,10 @@ class fhandler_base virtual int tcsetpgrp (const pid_t pid); virtual int tcgetpgrp (); virtual int is_tty () { return 0; } - virtual BOOL is_device () { return TRUE; } + virtual bool isdevice () { return true; } + virtual bool isfifo () { return false; } virtual char *ptsname () { return NULL;} - virtual class fhandler_socket *is_socket () { return 0; } + virtual class fhandler_socket *is_socket () { return NULL; } virtual class fhandler_console *is_console () { return 0; } virtual int is_windows () {return 0; } @@ -362,9 +337,9 @@ class fhandler_base virtual select_record *select_write (select_record *s); virtual select_record *select_except (select_record *s); virtual int ready_for_read (int fd, DWORD howlong); - virtual const char * get_native_name () + virtual const char *get_native_name () { - return windows_device_names[FHDEVN (status)]; + return dev ().fmt; } virtual bg_check_types bg_check (int) {return bg_ok;} void clear_readahead () @@ -375,12 +350,16 @@ class fhandler_base void operator delete (void *); virtual HANDLE get_guard () const {return NULL;} virtual void set_eof () {} - virtual DIR *opendir (path_conv& pc); + virtual DIR *opendir (); virtual dirent *readdir (DIR *); virtual _off64_t telldir (DIR *); virtual void seekdir (DIR *, _off64_t); virtual void rewinddir (DIR *); virtual int closedir (DIR *); + virtual bool is_slow () {return 0;} + bool is_auto_device () {return isdevice () && !dev ().isfs ();} + bool is_fs_special () {return dev ().isfs ();} + bool device_access_denied (int) __attribute__ ((regparm (1))); }; class fhandler_socket: public fhandler_base @@ -393,14 +372,12 @@ class fhandler_socket: public fhandler_base struct _WSAPROTOCOL_INFOA *prot_info_ptr; char *sun_path; int had_connect_or_listen; - int unit; public: - fhandler_socket (int unit); + fhandler_socket (); ~fhandler_socket (); int get_socket () { return (int) get_handle(); } - fhandler_socket * is_socket () { return this; } - int get_unit () { return unit; } + fhandler_socket *is_socket () { return this; } bool saw_shutdown_read () const {return FHISSETF (SHUTRD);} bool saw_shutdown_write () const {return FHISSETF (SHUTWR);} @@ -443,6 +420,7 @@ class fhandler_socket: public fhandler_base virtual void fixup_before_fork_exec (DWORD); void fixup_after_fork (HANDLE); void fixup_after_exec (HANDLE); + bool need_fixup_before () const {return true;} select_record *select_read (select_record *s); select_record *select_write (select_record *s); @@ -459,18 +437,20 @@ class fhandler_socket: public fhandler_base int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL); void signal_secret_event (); void close_secret_event (); - int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); + int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); + bool is_slow () {return 1;} }; class fhandler_pipe: public fhandler_base { +protected: HANDLE guard; bool broken_pipe; HANDLE writepipe_exists; DWORD orig_pid; unsigned id; - public: - fhandler_pipe (DWORD devtype); +public: + fhandler_pipe (); _off64_t lseek (_off64_t offset, int whence); select_record *select_read (select_record *s); select_record *select_write (select_record *s); @@ -485,9 +465,33 @@ class fhandler_pipe: public fhandler_base void fixup_after_exec (HANDLE); bool hit_eof (); void set_eof () {broken_pipe = true;} - friend int make_pipe (int fildes[2], unsigned int psize, int mode); HANDLE get_guard () const {return guard;} int ready_for_read (int fd, DWORD howlong); + static int create (fhandler_pipe *[2], unsigned, int, bool = false); + bool is_slow () {return 1;} + friend class fhandler_fifo; +}; + +class fhandler_fifo: public fhandler_pipe +{ + HANDLE output_handle; + HANDLE owner; // You can't have too many mutexes, now, can you? + ATOM upand; + long read_use; + long write_use; +public: + fhandler_fifo (); + int open (int flags, mode_t mode = 0); + int open_not_mine (int flags) __attribute__ ((regparm (2))); + int close (); + void set_use (int flags) __attribute__ ((regparm (2))); + bool isfifo () { return true; } + HANDLE& get_output_handle () { return output_handle; } + void set_output_handle (HANDLE h) { output_handle = h; } + void set_use (); + int dup (fhandler_base *child); + bool is_slow () {return 1;} + ATOM& get_atom () {return upand;} }; class fhandler_dev_raw: public fhandler_base @@ -503,7 +507,6 @@ class fhandler_dev_raw: public fhandler_base int is_writing : 1; int has_written : 1; int varblkop : 1; - int unit; virtual void clear (void); virtual int writebuf (void); @@ -513,14 +516,12 @@ class fhandler_dev_raw: public fhandler_base /* returns not null, if `win_error' determines an end of file condition */ virtual int is_eof(int win_error) = 0; - fhandler_dev_raw (DWORD dev, int unit); + fhandler_dev_raw (); public: ~fhandler_dev_raw (void); - int get_unit () { return unit; } - - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int close (void); void raw_read (void *ptr, size_t& ulen); @@ -541,9 +542,9 @@ class fhandler_dev_floppy: public fhandler_dev_raw virtual int is_eof (int win_error); public: - fhandler_dev_floppy (int unit); + fhandler_dev_floppy (); - virtual int open (path_conv *, int flags, mode_t mode = 0); + virtual int open (int flags, mode_t mode = 0); virtual int close (void); virtual _off64_t lseek (_off64_t offset, int whence); @@ -564,14 +565,14 @@ class fhandler_dev_tape: public fhandler_dev_raw virtual int is_eof (int win_error); public: - fhandler_dev_tape (int unit); + fhandler_dev_tape (); - virtual int open (path_conv *, int flags, mode_t mode = 0); + virtual int open (int flags, mode_t mode = 0); virtual int close (void); virtual _off64_t lseek (_off64_t offset, int whence); - virtual int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); + virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); virtual int dup (fhandler_base *child); @@ -596,32 +597,19 @@ class fhandler_disk_file: public fhandler_base { public: fhandler_disk_file (); - fhandler_disk_file (DWORD devtype); - int open (path_conv * real_path, int flags, mode_t mode); + int open (int flags, mode_t mode); int close (); int lock (int, struct flock *); - BOOL is_device () { return FALSE; } - int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3))); - int __stdcall fstat_helper (struct __stat64 *buf, path_conv *pc, - FILETIME ftCreateionTime, - FILETIME ftLastAccessTime, - FILETIME ftLastWriteTime, - DWORD nFileSizeHigh, - DWORD nFileSizeLow, - DWORD nFileIndexHigh = 0, - DWORD nFileIndexLow = 0, - DWORD nNumberOfLinks = 1) - __attribute__ ((regparm (3))); - int __stdcall fstat_by_handle (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3))); - int __stdcall fstat_by_name (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3))); + bool isdevice () { return false; } + int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, _off64_t off); int munmap (HANDLE h, caddr_t addr, size_t len); int msync (HANDLE h, caddr_t addr, size_t len, int flags); BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, DWORD size, void *address); - DIR *opendir (path_conv& pc); + DIR *opendir (); struct dirent *readdir (DIR *); _off64_t telldir (DIR *); void seekdir (DIR *, _off64_t); @@ -631,20 +619,19 @@ class fhandler_disk_file: public fhandler_base class fhandler_cygdrive: public fhandler_disk_file { - int unit; int ndrives; const char *pdrive; void set_drives (); public: - bool iscygdrive_root () const { return !unit; } - fhandler_cygdrive (int unit); - DIR *opendir (path_conv& pc); + bool iscygdrive_root () { return !dev ().minor; } + fhandler_cygdrive (); + DIR *opendir (); struct dirent *readdir (DIR *); _off64_t telldir (DIR *); void seekdir (DIR *, _off64_t); void rewinddir (DIR *); int closedir (DIR *); - int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3))); + int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); }; class fhandler_serial: public fhandler_base @@ -662,9 +649,9 @@ class fhandler_serial: public fhandler_base DWORD ev; /* Constructor */ - fhandler_serial (int unit); + fhandler_serial (); - int open (path_conv *, int flags, mode_t mode); + int open (int flags, mode_t mode); int close (); void init (HANDLE h, DWORD a, mode_t flags); void overlapped_setup (); @@ -692,6 +679,7 @@ class fhandler_serial: public fhandler_base select_record *select_read (select_record *s); select_record *select_write (select_record *s); select_record *select_except (select_record *s); + bool is_slow () {return 1;} }; #define acquire_output_mutex(ms) \ @@ -710,8 +698,8 @@ class fhandler_termios: public fhandler_base virtual int accept_input () {return 1;}; public: tty_min *tc; - fhandler_termios (DWORD dev, int unit = 0) : - fhandler_base (dev, unit) + fhandler_termios () : + fhandler_base () { set_need_fork_fixup (); } @@ -817,7 +805,7 @@ class fhandler_console: public fhandler_termios void cursor_set (BOOL, int, int); void cursor_get (int *, int *); void cursor_rel (int, int); - const unsigned char * write_normal (unsigned const char*, unsigned const char *); + const unsigned char *write_normal (unsigned const char*, unsigned const char *); void char_command (char); BOOL set_raw_win32_keyboard_mode (BOOL); int output_tcsetattr (int a, const struct termios *t); @@ -834,7 +822,7 @@ class fhandler_console: public fhandler_termios fhandler_console* is_console () { return this; } - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void doecho (const void *str, DWORD len) { (void) write (str, len); } @@ -861,15 +849,16 @@ class fhandler_console: public fhandler_termios void set_input_state (); void send_winch_maybe (); static tty_min *get_tty_stuff (int); + bool is_slow () {return 1;} }; class fhandler_tty_common: public fhandler_termios { public: - fhandler_tty_common (DWORD dev, int unit = 0) - : fhandler_termios (dev, unit), output_done_event (NULL), + fhandler_tty_common () + : fhandler_termios (), output_done_event (NULL), ioctl_request_event (NULL), ioctl_done_event (NULL), output_mutex (NULL), - input_mutex (NULL), input_available_event (NULL), inuse (NULL), ttynum (unit) + input_mutex (NULL), input_available_event (NULL), inuse (NULL) { // nothing to do } @@ -882,7 +871,6 @@ class fhandler_tty_common: public fhandler_termios HANDLE output_mutex, input_mutex; HANDLE input_available_event; HANDLE inuse; // used to indicate that a tty is in use - int ttynum; // Master tty num. DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms); void __release_output_mutex (const char *fn, int ln); @@ -890,7 +878,6 @@ class fhandler_tty_common: public fhandler_termios virtual int dup (fhandler_base *child); tty *get_ttyp () { return (tty *)tc; } - int get_unit () { return ttynum; } int close (); void set_close_on_exec (int val); @@ -898,6 +885,7 @@ class fhandler_tty_common: public fhandler_termios select_record *select_read (select_record *s); select_record *select_write (select_record *s); select_record *select_except (select_record *s); + bool is_slow () {return 1;} }; class fhandler_tty_slave: public fhandler_tty_common @@ -905,9 +893,8 @@ class fhandler_tty_slave: public fhandler_tty_common public: /* Constructor */ fhandler_tty_slave (); - fhandler_tty_slave (int); - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); void init (HANDLE, DWORD, mode_t); @@ -923,21 +910,24 @@ class fhandler_tty_slave: public fhandler_tty_common _off64_t lseek (_off64_t, int) { return 0; } select_record *select_read (select_record *s); int cygserver_attach_tty (HANDLE*, HANDLE*); + int get_unit () __attribute__ ((regparm (1))); }; class fhandler_pty_master: public fhandler_tty_common { int pktmode; // non-zero if pty in a packet mode. - public: +protected: + device slave; // device type of slave +public: int need_nl; // Next read should start with \n /* Constructor */ - fhandler_pty_master (DWORD devtype = FH_PTYM, int unit = -1); + fhandler_pty_master (); int process_slave_output (char *buf, size_t len, int pktmode_on); void doecho (const void *str, DWORD len); int accept_input (); - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); int close (); @@ -952,6 +942,7 @@ class fhandler_pty_master: public fhandler_tty_common void set_close_on_exec (int val); bool hit_eof (); + int get_unit () const { return slave.minor; } }; class fhandler_tty_master: public fhandler_pty_master @@ -960,12 +951,13 @@ class fhandler_tty_master: public fhandler_pty_master /* Constructor */ fhandler_console *console; // device handler to perform real i/o. - fhandler_tty_master (int unit); - int init (int); + fhandler_tty_master (); + int init (); int init_console (); void set_winsize (bool); void fixup_after_fork (HANDLE parent); void fixup_after_exec (HANDLE); + bool is_slow () {return 1;} }; class fhandler_dev_null: public fhandler_base @@ -983,7 +975,7 @@ class fhandler_dev_zero: public fhandler_base { public: fhandler_dev_zero (); - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); _off64_t lseek (_off64_t offset, int whence); @@ -994,7 +986,6 @@ class fhandler_dev_zero: public fhandler_base class fhandler_dev_random: public fhandler_base { protected: - int unit; HCRYPTPROV crypt_prov; long pseudo; @@ -1003,9 +994,8 @@ class fhandler_dev_random: public fhandler_base int pseudo_read (void *ptr, size_t len); public: - fhandler_dev_random (int unit); - int get_unit () { return unit; } - int open (path_conv *, int flags, mode_t mode = 0); + fhandler_dev_random (); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); _off64_t lseek (_off64_t offset, int whence); @@ -1018,20 +1008,19 @@ class fhandler_dev_random: public fhandler_base class fhandler_dev_mem: public fhandler_base { protected: - int unit; DWORD mem_size; _off64_t pos; public: - fhandler_dev_mem (int unit); + fhandler_dev_mem (); ~fhandler_dev_mem (void); - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t ulen); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); _off64_t lseek (_off64_t offset, int whence); int close (void); - int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); + int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); int dup (fhandler_base *child); HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, _off64_t off); @@ -1048,7 +1037,7 @@ class fhandler_dev_clipboard: public fhandler_base public: fhandler_dev_clipboard (); int is_windows (void) { return 1; } - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); _off64_t lseek (_off64_t offset, int whence); @@ -1073,7 +1062,7 @@ class fhandler_windows: public fhandler_base public: fhandler_windows (); int is_windows (void) { return 1; } - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); int ioctl (unsigned int cmd, void *); @@ -1085,6 +1074,7 @@ class fhandler_windows: public fhandler_base select_record *select_read (select_record *s); select_record *select_write (select_record *s); select_record *select_except (select_record *s); + bool is_slow () {return 1;} }; class fhandler_dev_dsp : public fhandler_base @@ -1099,13 +1089,13 @@ class fhandler_dev_dsp : public fhandler_base fhandler_dev_dsp (); ~fhandler_dev_dsp(); - int open (path_conv *, int flags, mode_t mode = 0); + int open (int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); int ioctl (unsigned int cmd, void *); _off64_t lseek (_off64_t, int); int close (void); - int dup (fhandler_base * child); + int dup (fhandler_base *child); void dump (void); void fixup_after_exec (HANDLE); }; @@ -1120,11 +1110,11 @@ class fhandler_virtual : public fhandler_base int fileid; // unique within each class public: - fhandler_virtual (DWORD devtype); + fhandler_virtual (); virtual ~fhandler_virtual(); virtual int exists(); - DIR *opendir (path_conv& pc); + DIR *opendir (); _off64_t telldir (DIR *); void seekdir (DIR *, _off64_t); void rewinddir (DIR *); @@ -1132,9 +1122,10 @@ class fhandler_virtual : public fhandler_base int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); _off64_t lseek (_off64_t, int); - int dup (fhandler_base * child); - int open (path_conv *, int flags, mode_t mode = 0); + int dup (fhandler_base *child); + int open (int flags, mode_t mode = 0); int close (void); + int __stdcall fstat (struct stat *buf) __attribute__ ((regparm (2))); virtual bool fill_filebuf (); void fixup_after_exec (HANDLE); }; @@ -1143,13 +1134,12 @@ class fhandler_proc: public fhandler_virtual { public: fhandler_proc (); - fhandler_proc (DWORD devtype); int exists(); struct dirent *readdir (DIR *); static DWORD get_proc_fhandler(const char *path); - int open (path_conv *real_path, int flags, mode_t mode = 0); - int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); + int open (int flags, mode_t mode = 0); + int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); bool fill_filebuf (); }; @@ -1166,8 +1156,8 @@ class fhandler_registry: public fhandler_proc void rewinddir (DIR *); int closedir (DIR *); - int open (path_conv *real_path, int flags, mode_t mode = 0); - int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); + int open (int flags, mode_t mode = 0); + int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); bool fill_filebuf (); int close (void); }; @@ -1180,11 +1170,18 @@ class fhandler_process: public fhandler_proc fhandler_process (); int exists(); struct dirent *readdir (DIR *); - int open (path_conv *real_path, int flags, mode_t mode = 0); - int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); + int open (int flags, mode_t mode = 0); + int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); bool fill_filebuf (); }; +struct fhandler_nodevice: public fhandler_base +{ + fhandler_nodevice (); + int open (int flags, mode_t mode = 0); + // int __stdcall fstat (struct __stat64 *buf, path_conv *); +}; + typedef union { char __base[sizeof (fhandler_base)]; @@ -1213,6 +1210,7 @@ typedef union char __tty_slave[sizeof (fhandler_tty_slave)]; char __virtual[sizeof (fhandler_virtual)]; char __windows[sizeof (fhandler_windows)]; + char __nodevice[sizeof (fhandler_nodevice)]; } fhandler_union; struct select_record @@ -1245,19 +1243,21 @@ class select_stuff { public: ~select_stuff (); - select_stuff (): always_ready (0), windows_used (0), start (0) - { - memset (device_specific, 0, sizeof (device_specific)); - } bool always_ready, windows_used; select_record start; - void *device_specific[FH_NDEV]; + void *device_specific_pipe; + void *device_specific_socket; + void *device_specific_serial; int test_and_set (int i, fd_set *readfds, fd_set *writefds, fd_set *exceptfds); int poll (fd_set *readfds, fd_set *writefds, fd_set *exceptfds); int wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds, DWORD ms); void cleanup (); + select_stuff (): always_ready (0), windows_used (0), start (0), + device_specific_pipe (0), + device_specific_socket (0), + device_specific_serial (0) {} }; int __stdcall set_console_state_for_spawn (); |