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
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2010-09-21 02:28:57 +0400
committerChristopher Faylor <me@cgf.cx>2010-09-21 02:28:57 +0400
commitdf4d2bea3d9446532844b92e3ac38d5472672e6f (patch)
tree54ba263493d5db5be2247b6d41f8d9e8ad6b9a80 /winsup
parent73b6b43ed33037f897ad95651f8ac2d1b233b25b (diff)
* 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.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/fhandler_tty.cc14
-rw-r--r--winsup/cygwin/include/sys/cygwin.h1
-rw-r--r--winsup/cygwin/signal.cc6
-rw-r--r--winsup/cygwin/spawn.cc6
5 files changed, 23 insertions, 15 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 98049f48c..b854c378b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,16 @@
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>
+
* fhandler_tty.cc (fhandler_tty_slave::init): Add additional checks to
determine when a process should grab control of a tty's pgid. Use
being_debugged() for consistency.
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 632e3aaf0..52b264a7d 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -711,19 +711,19 @@ fhandler_tty_slave::init (HANDLE f, DWORD a, mode_t)
int ret = open (flags);
- /* We should only grab this when the parent process owns the pgid
- (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 ()))
+ if (ret && !cygwin_finished_initializing && !being_debugged ())
{
/* 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
tty process group leader.
TODO: Investigate how SIGTTIN should be handled with pure-windows
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)
diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
index 37700a6e1..37a74513c 100644
--- a/winsup/cygwin/include/sys/cygwin.h
+++ b/winsup/cygwin/include/sys/cygwin.h
@@ -155,6 +155,7 @@ enum
PID_STOPPED = 0x00004, /* Waiting for SIGCONT. */
PID_TTYIN = 0x00008, /* Waiting for terminal input. */
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_ACTIVE = 0x00040, /* Pid accepts signals. */
PID_CYGPARENT = 0x00080, /* Set if parent was a cygwin app. */
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index e12f63e2d..615104e80 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -274,12 +274,6 @@ kill0 (pid_t pid, siginfo_t& si)
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);
}
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index cef4db81c..2005592f7 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -548,8 +548,9 @@ loop:
PWCHAR cwd;
cwd = NULL;
- if (!real_path.iscygexec())
+ if (!real_path.iscygexec ())
{
+ myself->process_state |= PID_NOTCYGWIN;
cygheap->cwd.cwd_lock.acquire ();
cwd = cygheap->cwd.win32.Buffer;
}
@@ -727,7 +728,8 @@ loop:
{
myself->set_has_pgid_children ();
ProtectHandle (pi.hThread);
- pinfo child (cygpid, PID_IN_USE);
+ pinfo child (cygpid,
+ PID_IN_USE | (real_path.iscygexec () ? 0 : PID_NOTCYGWIN));
if (!child)
{
syscall_printf ("pinfo failed");