diff options
author | Christopher Faylor <me@cgf.cx> | 2003-01-05 03:01:22 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-01-05 03:01:22 +0000 |
commit | 6125cfed4f0477da4866c8830ef532771564c293 (patch) | |
tree | c1bf09092248f69188f670a7b9e33b8597c034dc | |
parent | 16dfb6a94ebb9fe798e155a4adb7dba024404cea (diff) | |
download | newlib-github/unlabeled-1.153.2.zip newlib-github/unlabeled-1.153.2.tar.gz newlib-github/unlabeled-1.153.2.tar.bz2 |
Replace is_fs_device with is_fs_special throughout.github/unlabeled-1.153.2unlabeled-1.153.2
* Makefile.in (DLL_OFILES): Add fhandler_fifo.o.
* devices.h (fh_devices): Renumber some minor numbers to fit in 8 bits.
* dtable.cc (dtable::build_fhandler): Handle FH_FIFO. Set errno to ENODEV if
device not found.
* dtable::find_fifo: Define new function.
* dtable.h (dtable::find_fifo): Declare new function.
* fhandler.cc (fhandler_base::device_access_denied): Fix O_RDONLY test.
(fhandler_base::write): Use output file handle for writing.
(fhandler_base::fstat): Use is_fs_special rather than is_fs_device.
* fhandler.h (fhandler_base::is_fs_special): Rename from is_fs_device.
(fhandler_pipe): Make private elements protected so that fhandler_fifo can use
them too.
(fhandler_pipe::create): New function derived from make_pipe.
(fhandler_fifo): Add more needed elements.
(fhandler_pty_master::slave): Add to track slave device.
(fhandler_pty_master::get_unit): Define.
* fhandler_tty.cc (fhandler_tty_master::init): Register slave device.
(fhandler_pty_master::open): Ditto.
(symlink_info::parse_device): Handle fifo specially.
* pinfo.cc (_pinfo::commune_recv): Initial fifo implementation.
(_pinfo::commune_send): Ditto.
* pinfo.h (picom): Add PICOM_FIFO.
* pipe.cc (fhandler_pipe::close): Close input handle here specifically.
(fhandler_pipe::create): Rename from make_pipe. Create fhandlers rather than
fds.
(pipe): Use fhandler_pipe::create to create pipe.
(_pipe): Ditto.
* syscalls.cc (mknod): Accommodate fifos.
-rw-r--r-- | winsup/cygwin/fhandler.h | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 269fdae..00f92e1 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -146,12 +146,12 @@ class fhandler_base /* Non-virtual simple accessor functions. */ void set_io_handle (HANDLE x) { io_handle = x; } - 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; } + DWORD get_device () const { return dev.devn; } + DWORD get_major () const { return dev.major; } + DWORD get_minor () const { return dev.minor; } + virtual int get_unit () const { 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); } @@ -359,7 +359,7 @@ class fhandler_base virtual int closedir (DIR *); virtual bool is_slow () {return 0;} bool is_auto_device () {return isdevice () && !dev.isfs ();} - bool is_fs_device () {return dev.isfs ();} + bool is_fs_special () {return dev.isfs ();} bool device_access_denied (int) __attribute__ ((regparm (1))); }; @@ -442,12 +442,13 @@ class fhandler_socket: public fhandler_base class fhandler_pipe: public fhandler_base { +protected: HANDLE guard; bool broken_pipe; HANDLE writepipe_exists; DWORD orig_pid; unsigned id; - public: +public: fhandler_pipe (); __off64_t lseek (__off64_t offset, int whence); select_record *select_read (select_record *s); @@ -463,20 +464,32 @@ 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 (path_conv *, 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 (); bool is_slow () {return 1;} + ATOM& get_atom () {return upand;} }; class fhandler_dev_raw: public fhandler_base @@ -897,7 +910,9 @@ class fhandler_tty_slave: public fhandler_tty_common 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 */ @@ -921,6 +936,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 |