diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-03-27 13:43:14 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-03-27 13:43:14 +0300 |
commit | e21ac1ebdba953f1a88d5630b9868a7a780eb144 (patch) | |
tree | bbe42e6c65b91a91b0e04fa1df0f435d4a61619a | |
parent | 4af0c5e8f3ebc327f9fbb2302ba78097e08e47fe (diff) |
* fhandler_socket.cc: Create shared objects session local throughout.
* shared.cc (shared_name): Add argument to allow opening session
local shared memory.
* shared_info.h (shared_name): Change declaration accordingly.
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 10 | ||||
-rw-r--r-- | winsup/cygwin/shared.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/shared_info.h | 2 |
4 files changed, 17 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 57d26da74..624acd316 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2008-03-27 Corinna Vinschen <corinna@vinschen.de> + + * fhandler_socket.cc: Create shared objects session local throughout. + * shared.cc (shared_name): Add argument to allow opening session + local shared memory. + * shared_info.h (shared_name): Change declaration accordingly. + 2008-03-26 Christopher Faylor <me+cygwin@cgf.cx> * hookapi.cc (find_first_notloaded_dll): New function. diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 33f8ddf7e..bc37c44c8 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -405,7 +405,7 @@ fhandler_socket::af_local_set_secret (char *buf) } /* Maximum number of concurrently opened sockets from all Cygwin processes - on a machine. Note that shared sockets (through dup/fork/exec) are + per session. Note that shared sockets (through dup/fork/exec) are counted as one socket. */ #define NUM_SOCKS (65536 / sizeof (wsa_event)) @@ -426,7 +426,7 @@ search_wsa_event_slot (LONG new_serial_number) if (!wsa_slot_mtx) { wsa_slot_mtx = CreateMutex (&sec_all, FALSE, - shared_name (name, "sock", 0)); + shared_name (name, "sock", 0, true)); if (!wsa_slot_mtx) api_fatal ("Couldn't create/open shared socket mutex, %E"); } @@ -443,7 +443,8 @@ search_wsa_event_slot (LONG new_serial_number) while (wsa_events[slot].serial_number) { HANDLE searchmtx = OpenMutex (STANDARD_RIGHTS_READ, FALSE, - shared_name (searchname, "sock", wsa_events[slot].serial_number)); + shared_name (searchname, "sock", wsa_events[slot].serial_number, + true)); if (!searchmtx) break; /* Mutex still exists, attached socket is active, try next slot. */ @@ -476,7 +477,8 @@ fhandler_socket::init_events () if (!new_serial_number) /* 0 is reserved for global mutex */ InterlockedIncrement (&socket_serial_number); wsock_mtx = CreateMutex (&sec_all, FALSE, - shared_name (name, "sock", new_serial_number)); + shared_name (name, "sock", new_serial_number, + true)); if (!wsock_mtx) { debug_printf ("CreateMutex, %E"); diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index c30784295..6897f6172 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -35,11 +35,12 @@ user_info NO_COPY *user_shared; HANDLE NO_COPY cygwin_user_h; char * __stdcall -shared_name (char *ret_buf, const char *str, int num) +shared_name (char *ret_buf, const char *str, int num, bool session_local) { extern bool _cygwin_testing; - __small_sprintf (ret_buf, "%s%s.%s.%d", cygheap->shared_prefix, + __small_sprintf (ret_buf, "%s%s.%s.%d", + session_local ? "" : cygheap->shared_prefix, cygwin_version.shared_id, str, num); if (_cygwin_testing) strcat (ret_buf, cygwin_version.dll_build_date); diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index dc345d30f..9d2840def 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -176,7 +176,7 @@ struct console_state }; #endif -char *__stdcall shared_name (char *, const char *, int); +char *__stdcall shared_name (char *, const char *, int, bool = false); void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locations&, PSECURITY_ATTRIBUTES psa = &sec_all, DWORD access = FILE_MAP_READ | FILE_MAP_WRITE); |