diff options
author | scottc <scottc> | 2002-07-11 21:40:04 +0000 |
---|---|---|
committer | scottc <scottc> | 2002-07-11 21:40:04 +0000 |
commit | 1812384213f7320efb4ad46b40ac9637f5f0931c (patch) | |
tree | 0277a2b3bb5cafb374fd5abedb10f7a09449a57c | |
parent | c6a9e44197d3b4c3445498b2c6f1bf61f15851b0 (diff) | |
download | gdb-1812384213f7320efb4ad46b40ac9637f5f0931c.tar.gz |
* cygserver_process (process::process): Add the client's cygpid
and winpid to all tracing statements as appropriate.
(process::exit_code): Ditto.
(process_cache::check_and_remove_process): Ditto.
* cygserver_shm.cc (server_shmmgr::shmat): Ditto.
(server_shmmgr::shmdt): Ditto.
(server_shmmgr::shmctl): Add a process object argument and remove
the explicit cygpid argument. Add the client's cygpid and winpid
to all tracing statements as appropriate.
(server_shmmgr::shmget): Ditto.
(client_request_shm::serve): Update for the new signature of the
shmctl and shmget methods.
-rw-r--r-- | winsup/cygwin/ChangeLog | 15 | ||||
-rwxr-xr-x | winsup/cygwin/cygserver_process.cc | 25 | ||||
-rwxr-xr-x | winsup/cygwin/cygserver_shm.cc | 80 |
3 files changed, 74 insertions, 46 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 39c2051c6e1..424fec52112 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,20 @@ 2002-07-11 Conrad Scott <conrad.scott@dsl.pipex.com> + * cygserver_process (process::process): Add the client's cygpid + and winpid to all tracing statements as appropriate. + (process::exit_code): Ditto. + (process_cache::check_and_remove_process): Ditto. + * cygserver_shm.cc (server_shmmgr::shmat): Ditto. + (server_shmmgr::shmdt): Ditto. + (server_shmmgr::shmctl): Add a process object argument and remove + the explicit cygpid argument. Add the client's cygpid and winpid + to all tracing statements as appropriate. + (server_shmmgr::shmget): Ditto. + (client_request_shm::serve): Update for the new signature of the + shmctl and shmget methods. + +2002-07-11 Conrad Scott <conrad.scott@dsl.pipex.com> + * cygserver.cc (client_request_shutdown::serve): Don't set the shutdown flag directly, but send a SIGINT, as the signal handler sets the flag and the signal breaks the pause(2) in the main loop. diff --git a/winsup/cygwin/cygserver_process.cc b/winsup/cygwin/cygserver_process.cc index 2eb5a52295c..679319f0c5c 100755 --- a/winsup/cygwin/cygserver_process.cc +++ b/winsup/cygwin/cygserver_process.cc @@ -60,14 +60,14 @@ process::process (const pid_t cygpid, const DWORD winpid) _hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, winpid); if (!_hProcess) { - system_printf ("unable to obtain handle for new cache process %lu", - winpid); + system_printf ("unable to obtain handle for new cache process %d(%lu)", + _cygpid, _winpid); _hProcess = INVALID_HANDLE_VALUE; _exit_status = 0; } else - debug_printf ("got handle %p for new cache process %lu", - _hProcess, _winpid); + debug_printf ("got handle %p for new cache process %d(%lu)", + _hProcess, _cygpid, _winpid); InitializeCriticalSection (&_access); } @@ -91,7 +91,8 @@ process::exit_code () && _exit_status == STILL_ACTIVE && !GetExitCodeProcess (_hProcess, &_exit_status)) { - system_printf ("failed to retrieve exit code (%lu)", GetLastError ()); + system_printf ("failed to retrieve exit code for %d(%lu), error = %lu", + _cygpid, _winpid, GetLastError ()); _hProcess = INVALID_HANDLE_VALUE; } return _exit_status; @@ -176,7 +177,7 @@ process_cache::process_cache (const unsigned int initial_workers) if (!_cache_add_trigger) { - system_printf ("failed to create cache add trigger (%lu), terminating", + system_printf ("failed to create cache add trigger, error = %lu", GetLastError ()); abort (); } @@ -213,8 +214,9 @@ process_cache::process (const pid_t cygpid, const DWORD winpid) { LeaveCriticalSection (&_cache_write_access); system_printf (("process limit (%d processes) reached; " - "new connection refused"), - MAXIMUM_WAIT_OBJECTS - SPECIALS_COUNT); + "new connection refused for %d(%lu)"), + MAXIMUM_WAIT_OBJECTS - SPECIALS_COUNT, + cygpid, winpid); set_errno (EAGAIN); return NULL; } @@ -256,7 +258,7 @@ process_cache::wait_for_processes (const HANDLE interrupt_event) // Update `_wait_array' with handles of all current processes. const size_t count = sync_wait_array (interrupt_event); - debug_printf ("waiting on %u objects (out of %u processes)", + debug_printf ("waiting on %u objects in total (%u processes)", count, _processes_count); const DWORD rc = WaitForMultipleObjects (count, _wait_array, @@ -354,8 +356,8 @@ process_cache::check_and_remove_process (const size_t index) if (process->exit_code () == STILL_ACTIVE) return; - debug_printf ("process %lu has left the building ($? = %lu)", - process->_winpid, process->_exit_status); + debug_printf ("process %d(%lu) has left the building ($? = %lu)", + process->_cygpid, process->_winpid, process->_exit_status); /* Unlink the process object from the process list. */ @@ -374,7 +376,6 @@ process_cache::check_and_remove_process (const size_t index) _processes_head = process->_next; _processes_count -= 1; - SetEvent (_cache_add_trigger); LeaveCriticalSection (&_cache_write_access); /* Schedule any cleanup tasks for this process. */ diff --git a/winsup/cygwin/cygserver_shm.cc b/winsup/cygwin/cygserver_shm.cc index 27ca6ea7c49..f3d021a8a3e 100755 --- a/winsup/cygwin/cygserver_shm.cc +++ b/winsup/cygwin/cygserver_shm.cc @@ -168,9 +168,11 @@ public: int shmid, int shmflg, class process *); int shmctl (int & out_shmid, struct shmid_ds & out_ds, struct shminfo & out_shminfo, struct shm_info & out_shm_info, - const int shmid, int cmd, const struct shmid_ds &, pid_t); + const int shmid, int cmd, const struct shmid_ds &, + class process *); int shmdt (int shmid, const class process *); - int shmget (int & out_shmid, key_t, size_t, int shmflg, pid_t, uid_t, gid_t); + int shmget (int & out_shmid, key_t, size_t, int shmflg, uid_t, gid_t, + class process *); private: static server_shmmgr *_instance; @@ -392,8 +394,8 @@ server_shmmgr::shmat (HANDLE & hFileMap, const int shmid, const int shmflg, class process *const client) { - syscall_printf ("shmat (shmid = %d, shmflg = 0%o) for %d", - shmid, shmflg, client->cygpid ()); + syscall_printf ("shmat (shmid = %d, shmflg = 0%o) for %d(%lu)", + shmid, shmflg, client->cygpid (), client->winpid ()); int result = 0; EnterCriticalSection (&_segments_lock); @@ -411,11 +413,15 @@ server_shmmgr::shmat (HANDLE & hFileMap, LeaveCriticalSection (&_segments_lock); if (result < 0) - syscall_printf ("-1 [%d] = shmat (shmid = %d, shmflg = 0%o) for %d", - -result, shmid, shmflg, client->cygpid ()); + syscall_printf (("-1 [%d] = shmat (shmid = %d, shmflg = 0%o) " + "for %d(%lu)"), + -result, shmid, shmflg, + client->cygpid (), client->winpid ()); else - syscall_printf ("0x%x = shmat (shmid = %d, shmflg = 0%o) for %d", - hFileMap, shmid, shmflg, client->cygpid ()); + syscall_printf (("0x%x = shmat (shmid = %d, shmflg = 0%o) " + "for %d(%lu)"), + hFileMap, shmid, shmflg, + client->cygpid (), client->winpid ()); return result; } @@ -431,10 +437,10 @@ server_shmmgr::shmctl (int & out_shmid, struct shm_info & out_shm_info, const int shmid, const int cmd, const struct shmid_ds & ds, - const pid_t cygpid) + class process *const client) { - syscall_printf ("shmctl (shmid = %d, cmd = 0x%x) for %d", - shmid, cmd, cygpid); + syscall_printf ("shmctl (shmid = %d, cmd = 0x%x) for %d(%lu)", + shmid, cmd, client->cygpid (), client->winpid ()); int result = 0; EnterCriticalSection (&_segments_lock); @@ -468,7 +474,7 @@ server_shmmgr::shmctl (int & out_shmid, segptr->_ds.shm_perm.uid = ds.shm_perm.uid; segptr->_ds.shm_perm.gid = ds.shm_perm.gid; segptr->_ds.shm_perm.mode = ds.shm_perm.mode & 0777; - segptr->_ds.shm_lpid = cygpid; + segptr->_ds.shm_lpid = client->cygpid (); segptr->_ds.shm_ctime = time (NULL); // FIXME: sub-second times. break; @@ -515,16 +521,16 @@ server_shmmgr::shmctl (int & out_shmid, if (result < 0) syscall_printf (("-1 [%d] = " - "shmctl (shmid = %d, cmd = 0x%x) for %d"), + "shmctl (shmid = %d, cmd = 0x%x) for %d(%lu)"), -result, - shmid, cmd, cygpid); + shmid, cmd, client->cygpid (), client->winpid ()); else syscall_printf (("%d = " - "shmctl (shmid = %d, cmd = 0x%x) for %d"), + "shmctl (shmid = %d, cmd = 0x%x) for %d(%lu)"), ((cmd == SHM_STAT || cmd == SHM_INFO) ? out_shmid : result), - shmid, cmd, cygpid); + shmid, cmd, client->cygpid (), client->winpid ()); return result; } @@ -536,8 +542,8 @@ server_shmmgr::shmctl (int & out_shmid, int server_shmmgr::shmdt (const int shmid, const class process *const client) { - syscall_printf ("shmdt (shmid = %d) for %d", - shmid, client->cygpid ()); + syscall_printf ("shmdt (shmid = %d) for %d(%lu)", + shmid, client->cygpid (), client->winpid ()); int result = 0; EnterCriticalSection (&_segments_lock); @@ -558,11 +564,11 @@ server_shmmgr::shmdt (const int shmid, const class process *const client) LeaveCriticalSection (&_segments_lock); if (result < 0) - syscall_printf ("-1 [%d] = shmdt (shmid = %d) for %d", - -result, shmid, client->cygpid ()); + syscall_printf ("-1 [%d] = shmdt (shmid = %d) for %d(%lu)", + -result, shmid, client->cygpid (), client->winpid ()); else - syscall_printf ("%d = shmdt (shmid = %d) for %d", - result, shmid, client->cygpid ()); + syscall_printf ("%d = shmdt (shmid = %d) for %d(%lu)", + result, shmid, client->cygpid (), client->winpid ()); return result; } @@ -574,24 +580,28 @@ server_shmmgr::shmdt (const int shmid, const class process *const client) int server_shmmgr::shmget (int & out_shmid, const key_t key, const size_t size, const int shmflg, - const pid_t cygpid, const uid_t uid, const gid_t gid) + const uid_t uid, const gid_t gid, + class process *const client) { - syscall_printf ("shmget (key = 0x%016llx, size = %u, shmflg = 0%o) for %d", + syscall_printf (("shmget (key = 0x%016llx, size = %u, shmflg = 0%o) " + "for %d(%lu)"), key, size, shmflg, - cygpid); + client->cygpid (), client->winpid ()); int result = 0; EnterCriticalSection (&_segments_lock); if (key == IPC_PRIVATE) - result = new_segment (key, size, shmflg, cygpid, uid, gid); + result = new_segment (key, size, shmflg, + client->cygpid (), uid, gid); else { segment_t *const segptr = find_by_key (key); if (!segptr) if (shmflg & IPC_CREAT) - result = new_segment (key, size, shmflg, cygpid, uid, gid); + result = new_segment (key, size, shmflg, + client->cygpid (), uid, gid); else result = -ENOENT; else if (segptr->is_deleted ()) @@ -617,17 +627,17 @@ server_shmmgr::shmget (int & out_shmid, if (result < 0) syscall_printf (("-1 [%d] = " "shmget (key = 0x%016llx, size = %u, shmflg = 0%o) " - "for %d"), + "for %d(%lu)"), -result, key, size, shmflg, - cygpid); + client->cygpid (), client->winpid ()); else syscall_printf (("%d = " "shmget (key = 0x%016llx, size = %u, shmflg = 0%o) " - "for %d"), + "for %d(%lu)"), out_shmid, key, size, shmflg, - cygpid); + client->cygpid (), client->winpid ()); return result; } @@ -889,8 +899,9 @@ client_request_shm::serve (transport_layer_base *const conn, case SHMOP_shmget: result = shmmgr.shmget (_parameters.out.shmid, _parameters.in.key, _parameters.in.size, - _parameters.in.shmflg, _parameters.in.cygpid, - _parameters.in.uid, _parameters.in.gid); + _parameters.in.shmflg, + _parameters.in.uid, _parameters.in.gid, + client); break; case SHMOP_shmat: @@ -908,7 +919,8 @@ client_request_shm::serve (transport_layer_base *const conn, _parameters.out.ds, _parameters.out.shminfo, _parameters.out.shm_info, _parameters.in.shmid, _parameters.in.cmd, - _parameters.in.ds, _parameters.in.cygpid); + _parameters.in.ds, + client); break; } |