diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-07-21 09:47:46 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-07-21 09:47:46 +0000 |
commit | 2403726217c947c4c0308b0a54b832e071332539 (patch) | |
tree | 507c7755f3267936f426552dd063f85071835f33 /winsup/cygwin/fhandler.h | |
parent | 791aa84049199b54b47d5fb4fd2bc51d0934b5bb (diff) | |
download | newlib-2403726217c947c4c0308b0a54b832e071332539.zip newlib-2403726217c947c4c0308b0a54b832e071332539.tar.gz newlib-2403726217c947c4c0308b0a54b832e071332539.tar.bz2 |
* fhandler.h (class fhandler_socket): Rearrange slightly to keep
event handling methods and members together. Drop owner status flag.
Split wait method. Rename event handling methods for readability.
* fhandler_socket.cc (struct wsa_event): Add owner field.
(LOCK_EVENTS): New macro.
(UNLOCK_EVENTS): Ditto.
(fhandler_socket::init_events): rename from prepare.
(fhandler_socket::evaluate_events): First half of former wait method.
Do everything but wait. Allow specifiying whether or not events from
event_mask should be erased from wsock_events->events. Simplify
OOB handling. Allow sending SIGURG to any process (group).
(fhandler_socket::wait_for_events): Second half of former wait method.
Call evaluate_events and wait in a loop if socket is blocking.
(fhandler_socket::release_events): Rename from release.
(fhandler_socket::connect): Accomodate above name changes.
(fhandler_socket::accept): Ditto.
(fhandler_socket::recv_internal): Ditto.
(fhandler_socket::send_internal): Ditto.
(fhandler_socket::close): Ditto.
(fhandler_socket::fcntl): Always set owner to given input value on
F_SETOWN. Handle F_GETOWN.
* net.cc (fdsock): Accomodate above name changes.
Diffstat (limited to 'winsup/cygwin/fhandler.h')
-rw-r--r-- | winsup/cygwin/fhandler.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 06ae26e..afcd6db 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -390,6 +390,12 @@ class fhandler_socket: public fhandler_base HANDLE wsock_mtx; HANDLE wsock_evt; wsa_event *wsock_events; + public: + bool init_events (); + private: + int evaluate_events (const long event_mask, long &events, bool erase); + int wait_for_events (const long event_mask); + void release_events (); pid_t sec_pid; __uid32_t sec_uid; @@ -420,23 +426,16 @@ class fhandler_socket: public fhandler_base unsigned saw_shutdown_read : 1; /* Socket saw a SHUT_RD */ unsigned saw_shutdown_write : 1; /* Socket saw a SHUT_WR */ unsigned saw_reuseaddr : 1; /* Socket saw SO_REUSEADDR call */ - unsigned owner : 1; /* fcntl(F_SETOWN) called */ unsigned listener : 1; /* listen called */ unsigned connect_state : 2; public: status_flags () : async_io (0), saw_shutdown_read (0), saw_shutdown_write (0), - owner (0), listener (0), connect_state (unconnected) + listener (0), connect_state (unconnected) {} } status; public: - bool prepare (); - private: - int wait (long event_mask); - void release (); - - public: fhandler_socket (); ~fhandler_socket (); int get_socket () { return (int) get_handle(); } @@ -446,7 +445,6 @@ class fhandler_socket: public fhandler_base IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_read) IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_write) IMPLEMENT_STATUS_FLAG (bool, saw_reuseaddr) - IMPLEMENT_STATUS_FLAG (bool, owner) IMPLEMENT_STATUS_FLAG (bool, listener) IMPLEMENT_STATUS_FLAG (conn_state, connect_state) |