aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-02-26 20:50:25 +0000
committerChristopher Faylor <me@cgf.cx>2005-02-26 20:50:25 +0000
commit1a9a235a5af29c55f5fe84745b595f0d247f888e (patch)
tree23daad2557637028036061eeba3652115b924b61 /winsup/cygwin/pinfo.cc
parent92a7e06eb8c5f521079d9e799bfa34f479bc61ba (diff)
downloadnewlib-1a9a235a5af29c55f5fe84745b595f0d247f888e.zip
newlib-1a9a235a5af29c55f5fe84745b595f0d247f888e.tar.gz
newlib-1a9a235a5af29c55f5fe84745b595f0d247f888e.tar.bz2
* debug.cc (delete_handle): Report on handle value in debugging output.
* pinfo.h (_pinfo::exists): Declare "new" function. (_pinfo::kill): Ditto. * fhandler_termios.cc (tty_min::kill_pgrp): Use _pinfo::exists rather than proc_exists. * pinfo.cc (pinfo::init): Ditto. Don't do a low_priority_sleep(0) when looping to find exec'ed procinfo. (pinfo::release): Be more careful about unmapping and closing. * signal.cc (_pinfo::kill): Rename from kill_worker. Accommodate entry into _pinfo class. (kill0): Use _pinfo::kill rather than kill_worker. (kill_pgrp): Ditto. Use _pinfo::exists rather than proc_exists. * sigproc.cc (_pinfo::exists): Rename from proc_exists. (pid_exists): Use _pinfo::exists rather than proc_exists. (remove_proc): Ditto. * sigproc.h (proc_exists): Delete declaration.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index ce59d22..671c3c4 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -181,7 +181,7 @@ pinfo::init (pid_t n, DWORD flag, HANDLE h0)
}
void *mapaddr;
- bool createit = !!(flag & (PID_IN_USE | PID_EXECED));
+ int createit = flag & (PID_IN_USE | PID_EXECED);
bool created = false;
DWORD access = FILE_MAP_READ
| (flag & (PID_IN_USE | PID_EXECED | PID_MAP_RW)
@@ -257,7 +257,7 @@ pinfo::init (pid_t n, DWORD flag, HANDLE h0)
if (procinfo->process_state & PID_EXECED)
{
- assert (!i);
+ assert (i == 0);
pid_t realpid = procinfo->pid;
debug_printf ("execed process windows pid %d, cygwin pid %d", n, realpid);
if (realpid == n)
@@ -296,7 +296,8 @@ pinfo::init (pid_t n, DWORD flag, HANDLE h0)
loop:
release ();
- low_priority_sleep (0);
+ if (h0)
+ low_priority_sleep (0);
}
if (h)
@@ -338,7 +339,7 @@ _pinfo::set_ctty (tty_min *tc, int flags, fhandler_tty_slave *arch)
tc->ntty, sid, pid, pgid, tc->getsid ());
pinfo p (tc->getsid ());
- if (sid == pid && (!p || p->pid == pid || !proc_exists (p)))
+ if (sid == pid && (!p || p->pid == pid || !p->exists ()))
{
paranoid_printf ("resetting tty%d sid. Was %d, now %d. pgid was %d, now %d.",
tc->ntty, tc->getsid (), sid, tc->getpgid (), pgid);
@@ -1132,17 +1133,15 @@ pinfo::release ()
{
if (procinfo)
{
-#ifdef DEBUGGING
- if (((DWORD) procinfo & 0x77000000) == 0x61000000)
- try_to_debug ();
-#endif
- UnmapViewOfFile (procinfo);
+ void *unmap_procinfo = procinfo;
procinfo = NULL;
+ UnmapViewOfFile (unmap_procinfo);
}
if (h)
{
- ForceCloseHandle1 (h, pinfo_shared_handle);
+ HANDLE close_h = h;
h = NULL;
+ ForceCloseHandle1 (close_h, pinfo_shared_handle);
}
}