summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-11-06 06:36:32 +0000
committerChristopher Faylor <me@cgf.cx>2000-11-06 06:36:32 +0000
commitdd11f11faee36b8999cd6a7d56318e3be289f897 (patch)
treea922d160ecb185296abe958a65beff004280e47b /winsup/cygwin/spawn.cc
parente0997f5a0f47ef8af016a6358ebfadbb161c8c56 (diff)
downloadcygnal-dd11f11faee36b8999cd6a7d56318e3be289f897.tar.gz
cygnal-dd11f11faee36b8999cd6a7d56318e3be289f897.tar.bz2
cygnal-dd11f11faee36b8999cd6a7d56318e3be289f897.zip
* child_info.h (child_info): Add pppid_handle for closing the parent's of the
parent handle. * dcrt0.cc (_dll_crt0): Close parent's parent handle when spawned or forked. * debug.cc (add_handle): Correct erroneous reference to handle structure when printing warning. * exceptions.cc (interrupt_now): Always return 1. (interrupt_on_return): Accept a sigthread argument. Check to see if this argument has been trashed prior to setting up the stack return. (call_handler): Add a loop around attempts to dispatch signals to detect case where interrupt_on_return fails. (_sigdelayed): Set up a temporary frame pointer prior to calling stuff that could trigger an interrupt or the stack walking code will be very confused. * fork.cc (fork_parent): Move a lot of the setup of the child process into proc_subproc. * spawn.cc (spawn_guts): Ditto. Use ppid_handle to contact logical parent when reparenting. * pinfo.h (_pinfo): Remember the logical handle of the parent process. * sigproc.cc (proc_subproc): Record most stuff necessary for the _pinfo structure that is inferrable from myself when adding children. (wait_sig): Always set 'pending_signals' flag when about to kick off the signal scanning loop. Reset it only if there are no pending signals.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc23
1 files changed, 2 insertions, 21 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index a430cf954..8e2e490be 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -707,22 +707,6 @@ skip_arg_parsing:
}
child->username[0] = '\0';
child->progname[0] = '\0';
- child->ppid = myself->pid;
- child->gid = myself->gid;
- child->pgid = myself->pgid;
- child->sid = myself->sid;
- child->ctty = myself->ctty;
- child->umask = myself->umask;
- child->process_state |= PID_INITIALIZING;
- if (myself->use_psid)
- {
- child->use_psid = 1;
- memcpy (child->psid, myself->psid, MAX_SID_LEN);
- }
- memcpy (child->logsrv, myself->logsrv, MAX_HOST_NAME);
- memcpy (child->domain, myself->domain, MAX_COMPUTERNAME_LENGTH+1);
- memcpy (child->root, myself->root, MAX_PATH+1);
- child->rootlen = myself->rootlen;
child->dwProcessId = pi.dwProcessId;
child->hProcess = pi.hProcess;
child.remember ();
@@ -808,20 +792,17 @@ skip_arg_parsing:
{
int rc = 0;
HANDLE oldh = myself->hProcess;
- HANDLE h = OpenProcess (PROCESS_ALL_ACCESS, FALSE,
- parent->dwProcessId);
+ HANDLE h = myself->ppid_handle;
sigproc_printf ("parent handle %p, pid %d", h, parent->dwProcessId);
if (h == NULL && GetLastError () == ERROR_INVALID_PARAMETER)
- rc = 1;
+ rc = 0;
else if (h)
{
- ProtectHandle (h);
rc = DuplicateHandle (hMainProc, pi.hProcess,
h, &myself->hProcess, 0, FALSE,
DUPLICATE_SAME_ACCESS);
sigproc_printf ("%d = DuplicateHandle, oldh %p, newh %p",
rc, oldh, myself->hProcess);
- ForceCloseHandle (h);
}
if (!rc)
{