diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-10-22 10:07:59 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-10-22 10:07:59 +0000 |
commit | e217832c4c4d8dba3c13af35b1d107851271b77d (patch) | |
tree | 07fd38a06152f7c715f38cd2bf0a6d07064f8ff4 /winsup/cygwin/include | |
parent | 567970786e0db398b9c2a990efb9060b95406e12 (diff) | |
download | cygnal-e217832c4c4d8dba3c13af35b1d107851271b77d.tar.gz cygnal-e217832c4c4d8dba3c13af35b1d107851271b77d.tar.bz2 cygnal-e217832c4c4d8dba3c13af35b1d107851271b77d.zip |
* Makefile.in: Add $(LIBSERVER) rule.
* cygserver.h: Moved from include/cygwin to here.
* cygserver_ipc.h: Moved from ../cygserver to here.
* cygserver_shm.h: Ditto.
* cygwin.din: Add shmat, shmctl, shmdt and shmget.
* fhandler_tty.cc (fhandler_tty_slave::open): Don't warn about handle
dup'ing if not build with USE_SERVER.
* shm.cc: Include cygerrno.h unconditionally.
(shmat): Set errno to ENOSYS and return -1 if not build with
USE_SERVER.
(shmctl): Ditto.
(shmdt): Ditto.
(shmget): Ditto.
* woutsup.h: Remove.
* include/cygwin/cygserver_process.h: Moved to ../cygserver directory.
* include/cygwin/cygserver_transport.h: Ditto.
* include/cygwin/cygserver_transport_pipes.h: Ditto.
* include/cygwin/cygserver_transport_sockets.h: Ditto.
* include/cygwin/version.h: Bump API minor number.
Diffstat (limited to 'winsup/cygwin/include')
-rwxr-xr-x | winsup/cygwin/include/cygwin/cygserver.h | 184 | ||||
-rwxr-xr-x | winsup/cygwin/include/cygwin/cygserver_process.h | 164 | ||||
-rwxr-xr-x | winsup/cygwin/include/cygwin/cygserver_transport.h | 39 | ||||
-rwxr-xr-x | winsup/cygwin/include/cygwin/cygserver_transport_pipes.h | 53 | ||||
-rwxr-xr-x | winsup/cygwin/include/cygwin/cygserver_transport_sockets.h | 46 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/version.h | 3 |
6 files changed, 2 insertions, 487 deletions
diff --git a/winsup/cygwin/include/cygwin/cygserver.h b/winsup/cygwin/include/cygwin/cygserver.h deleted file mode 100755 index d4ea70fbb..000000000 --- a/winsup/cygwin/include/cygwin/cygserver.h +++ /dev/null @@ -1,184 +0,0 @@ -/* cygserver.h - - Copyright 2001, 2002 Red Hat Inc. - - Written by Egor Duda <deo@logos-m.ru> - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _CYGSERVER_H_ -#define _CYGSERVER_H_ - -#ifdef __GNUC__ -#define CYGSERVER_PACKED __attribute__ ((packed)) -#else -#define CYGSERVER_PACKED -#endif - -#define CYGWIN_SERVER_VERSION_MAJOR 1 -#define CYGWIN_SERVER_VERSION_API 1 -#define CYGWIN_SERVER_VERSION_MINOR 0 -#define CYGWIN_SERVER_VERSION_PATCH 0 - -typedef enum { - CYGSERVER_UNKNOWN = 0, - CYGSERVER_OK, - CYGSERVER_UNAVAIL -} cygserver_states; - -/*---------------------------------------------------------------------------* - * class client_request - *---------------------------------------------------------------------------*/ - -class transport_layer_base; - -#ifndef __INSIDE_CYGWIN__ -class process_cache; -#endif - -class client_request -{ -protected: - typedef enum { - CYGSERVER_REQUEST_INVALID, - CYGSERVER_REQUEST_GET_VERSION, - CYGSERVER_REQUEST_SHUTDOWN, - CYGSERVER_REQUEST_ATTACH_TTY, - CYGSERVER_REQUEST_SHM, - CYGSERVER_REQUEST_LAST - } request_code_t; - - struct header_t - { - size_t msglen; - union - { - request_code_t request_code; - ssize_t error_code; - }; - - header_t () {}; - header_t (request_code_t, size_t); - } CYGSERVER_PACKED; - -public: -#ifndef __INSIDE_CYGWIN__ - static void handle_request (transport_layer_base *, process_cache *); -#endif - - client_request (request_code_t request_code, - void *buf = NULL, - size_t bufsiz = 0); - virtual ~client_request (); - - request_code_t request_code () const { return _header.request_code; } - - ssize_t error_code () const { return _header.error_code; }; - void error_code (ssize_t error_code) { _header.error_code = error_code; }; - - size_t msglen () const { return _header.msglen; }; - void msglen (size_t len) { _header.msglen = len; }; - - int make_request (); - -protected: - virtual void send (transport_layer_base *); - -private: - header_t _header; - void * const _buf; - const size_t _buflen; - -#ifndef __INSIDE_CYGWIN__ - void handle (transport_layer_base *, process_cache *); - virtual void serve (transport_layer_base *, process_cache *) = 0; -#endif -}; - -/*---------------------------------------------------------------------------* - * class client_request_get_version - *---------------------------------------------------------------------------*/ - -class client_request_get_version : public client_request -{ -private: - struct request_get_version - { - DWORD major, api, minor, patch; - } CYGSERVER_PACKED; - -public: - client_request_get_version (); - bool check_version () const; - -private: - struct request_get_version version; - -#ifndef __INSIDE_CYGWIN__ - virtual void serve (transport_layer_base *, process_cache *); -#endif -}; - -/*---------------------------------------------------------------------------* - * class client_request_shutdown - * - * Nb. This whole class is only !__INSIDE_CYGWIN__ since it is used - * solely by cygserver itself. - *---------------------------------------------------------------------------*/ - -#ifndef __INSIDE_CYGWIN__ - -class client_request_shutdown : public client_request -{ -public: - client_request_shutdown (); - -private: - virtual void serve (transport_layer_base *, process_cache *); -}; - -#endif /* !__INSIDE_CYGWIN__ */ - -/*---------------------------------------------------------------------------* - * class client_request_attach_tty - *---------------------------------------------------------------------------*/ - -class client_request_attach_tty : public client_request -{ -private: - struct request_attach_tty - { - DWORD pid, master_pid; - HANDLE from_master, to_master; - } CYGSERVER_PACKED; - -public: -#ifdef __INSIDE_CYGWIN__ - client_request_attach_tty (DWORD nmaster_pid, - HANDLE nfrom_master, HANDLE nto_master); -#else - client_request_attach_tty (); -#endif - - HANDLE from_master () const { return req.from_master; }; - HANDLE to_master () const { return req.to_master; }; - -protected: - virtual void send (transport_layer_base *); - -private: - struct request_attach_tty req; - -#ifndef __INSIDE_CYGWIN__ - virtual void serve (transport_layer_base *, process_cache *); -#endif -}; - -extern bool check_cygserver_available (); -extern void cygserver_init (); - -#endif /* _CYGSERVER_H_ */ diff --git a/winsup/cygwin/include/cygwin/cygserver_process.h b/winsup/cygwin/include/cygwin/cygserver_process.h deleted file mode 100755 index 25c634e9e..000000000 --- a/winsup/cygwin/include/cygwin/cygserver_process.h +++ /dev/null @@ -1,164 +0,0 @@ -/* cygserver_process.h - - Copyright 2001, 2002 Red Hat Inc. - - Written by Robert Collins <rbtcollins@hotmail.com> - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _CYGSERVER_PROCESS_ -#define _CYGSERVER_PROCESS_ - -#include <assert.h> - -#include "threaded_queue.h" - -class process_cleanup : public queue_request -{ -public: - process_cleanup (class process *const theprocess) - : _process (theprocess) - { - assert (_process); - } - - virtual ~process_cleanup (); - - virtual void process (); - -private: - class process *const _process; -}; - -class process; - -class cleanup_routine -{ - friend class process; - -public: - cleanup_routine (void *const key) - : _key (key), - _next (NULL) - {} - - virtual ~cleanup_routine (); - - bool operator== (const cleanup_routine &rhs) const - { - return _key == rhs._key; - } - - void *key () const { return _key; } - - /* MUST BE SYNCHRONOUS */ - virtual void cleanup (class process *) = 0; - -private: - void *const _key; - cleanup_routine *_next; -}; - -class process_cache; - -class process -{ - friend class process_cache; - friend class process_cleanup; - -public: - process (pid_t cygpid, DWORD winpid); - ~process (); - - pid_t cygpid () const { return _cygpid; } - DWORD winpid () const { return _winpid; } - HANDLE handle () const { return _hProcess; } - - bool is_active () const { return _exit_status == STILL_ACTIVE; } - - void hold () { EnterCriticalSection (&_access); } - void release () { LeaveCriticalSection (&_access); } - - bool add (cleanup_routine *); - bool remove (const cleanup_routine *); - -private: - const pid_t _cygpid; - const DWORD _winpid; - HANDLE _hProcess; - long _cleaning_up; - DWORD _exit_status; // Set in the constructor and in exit_code (). - cleanup_routine *_routines_head; - /* used to prevent races-on-delete */ - CRITICAL_SECTION _access; - class process *_next; - - DWORD check_exit_code (); - void cleanup (); -}; - -class process_cache -{ - // Number of special (i.e., non-process) handles in _wait_array. - // See wait_for_processes () and sync_wait_array () for details. - enum { - SPECIALS_COUNT = 2 - }; - - class submission_loop : public queue_submission_loop - { - public: - submission_loop (process_cache *const cache, threaded_queue *const queue) - : queue_submission_loop (queue, true), - _cache (cache) - { - assert (_cache); - } - - private: - process_cache *const _cache; - - virtual void request_loop (); - }; - - friend class submission_loop; - -public: - process_cache (unsigned int initial_workers); - ~process_cache (); - - class process *process (pid_t cygpid, DWORD winpid); - - bool running () const { return _queue.running (); } - - bool start () { return _queue.start (); } - bool stop () { return _queue.stop (); } - -private: - threaded_queue _queue; - submission_loop _submitter; - - size_t _processes_count; - class process *_processes_head; // A list sorted by winpid. - - // Access to the _wait_array and related fields is not thread-safe, - // since they are used solely by wait_for_processes () and its callees. - - HANDLE _wait_array[MAXIMUM_WAIT_OBJECTS]; - class process *_process_array[MAXIMUM_WAIT_OBJECTS]; - - HANDLE _cache_add_trigger; // Actually both add and remove. - CRITICAL_SECTION _cache_write_access; // Actually both read and write access. - - void wait_for_processes (HANDLE interrupt); - size_t sync_wait_array (HANDLE interrupt); - void check_and_remove_process (const size_t index); - - class process *find (DWORD winpid, class process **previous = NULL); -}; - -#endif /* _CYGSERVER_PROCESS_ */ diff --git a/winsup/cygwin/include/cygwin/cygserver_transport.h b/winsup/cygwin/include/cygwin/cygserver_transport.h deleted file mode 100755 index 915f35e66..000000000 --- a/winsup/cygwin/include/cygwin/cygserver_transport.h +++ /dev/null @@ -1,39 +0,0 @@ -/* cygserver_transport.h - - Copyright 2001, 2002 Red Hat Inc. - - Written by Robert Collins <rbtcollins@hotmail.com> - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _CYGSERVER_TRANSPORT_ -#define _CYGSERVER_TRANSPORT_ - -class transport_layer_base *create_server_transport (); - -class transport_layer_base -{ -public: -#ifndef __INSIDE_CYGWIN__ - virtual int listen () = 0; - virtual class transport_layer_base *accept (bool *recoverable) = 0; -#endif - - virtual void close () = 0; - virtual ssize_t read (void *buf, size_t len) = 0; - virtual ssize_t write (void *buf, size_t len) = 0; - virtual int connect () = 0; - -#ifndef __INSIDE_CYGWIN__ - virtual void impersonate_client (); - virtual void revert_to_self (); -#endif - - virtual ~transport_layer_base (); -}; - -#endif /* _CYGSERVER_TRANSPORT_ */ diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h b/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h deleted file mode 100755 index 4bea2eb13..000000000 --- a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h +++ /dev/null @@ -1,53 +0,0 @@ -/* cygserver_transport_pipes.h - - Copyright 2001, 2002 Red Hat Inc. - - Written by Robert Collins <rbtcollins@hotmail.com> - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _CYGSERVER_TRANSPORT_PIPES_ -#define _CYGSERVER_TRANSPORT_PIPES_ - -/* Named pipes based transport, for security on NT */ -class transport_layer_pipes : public transport_layer_base -{ -public: -#ifndef __INSIDE_CYGWIN__ - virtual int listen (); - virtual class transport_layer_pipes *accept (bool *recoverable); -#endif - - virtual void close (); - virtual ssize_t read (void *buf, size_t len); - virtual ssize_t write (void *buf, size_t len); - virtual int connect (); - -#ifndef __INSIDE_CYGWIN__ - virtual void impersonate_client (); - virtual void revert_to_self (); -#endif - - transport_layer_pipes (); - virtual ~transport_layer_pipes (); - -private: - /* for pipe based communications */ - void init_security (); - - //FIXME: allow inited, sd, all_nih_.. to be static members - SECURITY_DESCRIPTOR _sd; - SECURITY_ATTRIBUTES _sec_all_nih; - const char *const _pipe_name; - HANDLE _hPipe; - const bool _is_accepted_endpoint; - bool _is_listening_endpoint; - - transport_layer_pipes (HANDLE hPipe); -}; - -#endif /* _CYGSERVER_TRANSPORT_PIPES_ */ diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h b/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h deleted file mode 100755 index d960f9c2c..000000000 --- a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h +++ /dev/null @@ -1,46 +0,0 @@ -/* cygserver_transport_sockets.h - - Copyright 2001, 2002 Red Hat Inc. - - Written by Robert Collins <rbtcollins@hotmail.com> - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifndef _CYGSERVER_TRANSPORT_SOCKETS_ -#define _CYGSERVER_TRANSPORT_SOCKETS_ - -#include <sys/socket.h> -#include <sys/un.h> - -class transport_layer_sockets : public transport_layer_base -{ -public: -#ifndef __INSIDE_CYGWIN__ - virtual int listen (); - virtual class transport_layer_sockets *accept (bool *recoverable); -#endif - - virtual void close (); - virtual ssize_t read (void *buf, size_t len); - virtual ssize_t write (void *buf, size_t len); - virtual int connect (); - - transport_layer_sockets (); - virtual ~transport_layer_sockets (); - -private: - /* for socket based communications */ - int _fd; - struct sockaddr_un _addr; - socklen_t _addr_len; - const bool _is_accepted_endpoint; - bool _is_listening_endpoint; - - transport_layer_sockets (int fd); -}; - -#endif /* _CYGSERVER_TRANSPORT_SOCKETS_ */ diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 26b1685f6..c4c3c9edb 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -219,13 +219,14 @@ details. */ openpty, forkpty, revoke, logwtmp, updwtmp 94: Export getopt, getopt_long, optarg, opterr, optind, optopt, optreset, __check_rhosts_file, __rcmd_errstr. + 95: Export shmat, shmctl, shmdt, shmget. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 94 +#define CYGWIN_VERSION_API_MINOR 95 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible |