Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-08-26 07:48:37 +0400
committerChristopher Faylor <me@cgf.cx>2000-08-26 07:48:37 +0400
commitfde520bf6c1ac103d1d5904069da92acf14c9fd6 (patch)
treeb9d8ce23faa1aa20818ada40a6eca87cdde4816d /winsup/cygwin/pinfo.cc
parent3c2c374555e45b55f0fdc6f1c37257bc631cf5ab (diff)
* pinfo.h (pinfo): Un-inline release.
* pinfo.cc (pinfo::release): Move here from pinfo.h. * sigproc.cc (proc_terminate): Remove bogus 'pinfo child' which caused strange destruction of random regions of memory when destructor was invoked.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc29
1 files changed, 21 insertions, 8 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 08d34dfb2..0d7e785c3 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -197,7 +197,7 @@ pinfo::init (pid_t n, DWORD create, HANDLE in_h)
{
if (n == myself->pid)
{
- child = myself;
+ procinfo = myself;
destroy = 0;
h = NULL;
return;
@@ -235,16 +235,16 @@ pinfo::init (pid_t n, DWORD create, HANDLE in_h)
{
if (create)
__seterrno ();
- child = NULL;
+ procinfo = NULL;
return;
}
ProtectHandle1 (h, pinfo_shared_handle);
- child = (_pinfo *) MapViewOfFile (h, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
+ procinfo = (_pinfo *) MapViewOfFile (h, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
- if (child->process_state & PID_EXECED)
+ if (procinfo->process_state & PID_EXECED)
{
- pid_t realpid = child->pid;
+ pid_t realpid = procinfo->pid;
debug_printf ("execed process windows pid %d, cygwin pid %d", n, realpid);
release ();
if (realpid == n)
@@ -255,16 +255,29 @@ pinfo::init (pid_t n, DWORD create, HANDLE in_h)
if (created)
{
if (!(create & PID_EXECED))
- child->pid = n;
+ procinfo->pid = n;
else
{
- child->pid = myself->pid;
- child->process_state |= PID_IN_USE | PID_EXECED;
+ procinfo->pid = myself->pid;
+ procinfo->process_state |= PID_IN_USE | PID_EXECED;
}
}
destroy = 1;
}
+void
+pinfo::release ()
+{
+ if (h)
+ {
+#ifdef DEBUGGING
+ if (((DWORD) procinfo & 0x77000000) == 0x61000000) try_to_debug ();
+#endif
+ UnmapViewOfFile (procinfo);
+ ForceCloseHandle1 (h, pinfo_shared_handle);
+ h = NULL;
+ }
+}
/* DOCTOOL-START