* include/sys/cygwin.h (PID_NOTCYGWIN): New enum.
* spawn.cc (spawn_guts): Set a flag when a process is not a cygwin process. * fhandler_tty.cc (fhandler_tty_slave::init): Remove previous change. Try a different method to determine when we should become the process group owner. * signal.cc (kill0): Remove archaic code which dealt with never-set flag.
This commit is contained in:
parent
73b6b43ed3
commit
df4d2bea3d
@ -1,3 +1,14 @@
|
|||||||
|
2010-09-20 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* include/sys/cygwin.h (PID_NOTCYGWIN): New enum.
|
||||||
|
* spawn.cc (spawn_guts): Set a flag when a process is not a cygwin
|
||||||
|
process.
|
||||||
|
* fhandler_tty.cc (fhandler_tty_slave::init): Remove previous change.
|
||||||
|
Try a different method to determine when we should become the process
|
||||||
|
group owner.
|
||||||
|
* signal.cc (kill0): Remove archaic code which dealt with never-set
|
||||||
|
flag.
|
||||||
|
|
||||||
2010-09-20 Christopher Faylor <me+cygwin@cgf.cx>
|
2010-09-20 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
* fhandler_tty.cc (fhandler_tty_slave::init): Add additional checks to
|
* fhandler_tty.cc (fhandler_tty_slave::init): Add additional checks to
|
||||||
|
@ -711,19 +711,19 @@ fhandler_tty_slave::init (HANDLE f, DWORD a, mode_t)
|
|||||||
|
|
||||||
int ret = open (flags);
|
int ret = open (flags);
|
||||||
|
|
||||||
/* We should only grab this when the parent process owns the pgid
|
if (ret && !cygwin_finished_initializing && !being_debugged ())
|
||||||
(which could happen when a cygwin process starts a DOS process which
|
|
||||||
starts a cygwin process or when we are being started directly from a
|
|
||||||
windows process, e.g., from the CMD prompt. */
|
|
||||||
if (ret && !cygwin_finished_initializing && !being_debugged ()
|
|
||||||
&& (myself->ppid == 1 || myself->ppid == tc->getpgid ()))
|
|
||||||
{
|
{
|
||||||
/* This only occurs when called from dtable::init_std_file_from_handle
|
/* This only occurs when called from dtable::init_std_file_from_handle
|
||||||
We have been started from a non-Cygwin process. So we should become
|
We have been started from a non-Cygwin process. So we should become
|
||||||
tty process group leader.
|
tty process group leader.
|
||||||
TODO: Investigate how SIGTTIN should be handled with pure-windows
|
TODO: Investigate how SIGTTIN should be handled with pure-windows
|
||||||
programs. */
|
programs. */
|
||||||
tc->setpgid (myself->pgid);
|
pinfo p (tc->getpgid ());
|
||||||
|
/* We should only grab this when the process group owner for this
|
||||||
|
tty is a non-cygwin process or we've been started directly
|
||||||
|
from a non-Cygwin process with no Cygwin ancestry. */
|
||||||
|
if (!p || ISSTATE (p, PID_NOTCYGWIN))
|
||||||
|
tc->setpgid (myself->pgid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f != INVALID_HANDLE_VALUE)
|
if (f != INVALID_HANDLE_VALUE)
|
||||||
|
@ -155,6 +155,7 @@ enum
|
|||||||
PID_STOPPED = 0x00004, /* Waiting for SIGCONT. */
|
PID_STOPPED = 0x00004, /* Waiting for SIGCONT. */
|
||||||
PID_TTYIN = 0x00008, /* Waiting for terminal input. */
|
PID_TTYIN = 0x00008, /* Waiting for terminal input. */
|
||||||
PID_TTYOU = 0x00010, /* Waiting for terminal output. */
|
PID_TTYOU = 0x00010, /* Waiting for terminal output. */
|
||||||
|
PID_NOTCYGWIN = 0x00080, /* Set if process is not a cygwin app. */
|
||||||
PID_ORPHANED = 0x00020, /* Member of an orphaned process group. */
|
PID_ORPHANED = 0x00020, /* Member of an orphaned process group. */
|
||||||
PID_ACTIVE = 0x00040, /* Pid accepts signals. */
|
PID_ACTIVE = 0x00040, /* Pid accepts signals. */
|
||||||
PID_CYGPARENT = 0x00080, /* Set if parent was a cygwin app. */
|
PID_CYGPARENT = 0x00080, /* Set if parent was a cygwin app. */
|
||||||
|
@ -274,12 +274,6 @@ kill0 (pid_t pid, siginfo_t& si)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Silently ignore stop signals from a member of orphaned process group.
|
|
||||||
FIXME: Why??? */
|
|
||||||
if (ISSTATE (myself, PID_ORPHANED) &&
|
|
||||||
(si.si_signo == SIGTSTP || si.si_signo == SIGTTIN || si.si_signo == SIGTTOU))
|
|
||||||
si.si_signo = 0;
|
|
||||||
|
|
||||||
return (pid > 0) ? pinfo (pid)->kill (si) : kill_pgrp (-pid, si);
|
return (pid > 0) ? pinfo (pid)->kill (si) : kill_pgrp (-pid, si);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,8 +548,9 @@ loop:
|
|||||||
|
|
||||||
PWCHAR cwd;
|
PWCHAR cwd;
|
||||||
cwd = NULL;
|
cwd = NULL;
|
||||||
if (!real_path.iscygexec())
|
if (!real_path.iscygexec ())
|
||||||
{
|
{
|
||||||
|
myself->process_state |= PID_NOTCYGWIN;
|
||||||
cygheap->cwd.cwd_lock.acquire ();
|
cygheap->cwd.cwd_lock.acquire ();
|
||||||
cwd = cygheap->cwd.win32.Buffer;
|
cwd = cygheap->cwd.win32.Buffer;
|
||||||
}
|
}
|
||||||
@ -727,7 +728,8 @@ loop:
|
|||||||
{
|
{
|
||||||
myself->set_has_pgid_children ();
|
myself->set_has_pgid_children ();
|
||||||
ProtectHandle (pi.hThread);
|
ProtectHandle (pi.hThread);
|
||||||
pinfo child (cygpid, PID_IN_USE);
|
pinfo child (cygpid,
|
||||||
|
PID_IN_USE | (real_path.iscygexec () ? 0 : PID_NOTCYGWIN));
|
||||||
if (!child)
|
if (!child)
|
||||||
{
|
{
|
||||||
syscall_printf ("pinfo failed");
|
syscall_printf ("pinfo failed");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user