diff options
author | Christopher Faylor <me@cgf.cx> | 2000-10-24 02:25:27 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-10-24 02:25:27 +0000 |
commit | 4c45a897440c6517ab607daa36163f589863d09c (patch) | |
tree | 51c40b8f6e77c09fe5adfbec9b21c93a4b9b7495 | |
parent | 00ee2b44e796d03e3ce805a731d719ad17254fac (diff) | |
download | newlib-4c45a897440c6517ab607daa36163f589863d09c.zip newlib-4c45a897440c6517ab607daa36163f589863d09c.tar.gz newlib-4c45a897440c6517ab607daa36163f589863d09c.tar.bz2 |
* exceptions.cc (signal_exit): Kill any executing child process if we're dying.
* path.h: Remove unneeded extern.
* spawn.cc (std_suffixes): Make static. Don't set dwProcessId here since it
makes the process unsignalable. Set strace flag that this is an execed process
stub.
* strace.cc (strace::vsprntf): Use strace flag to indicate when to visually
flag that this is an exec stub.
* include/sys/strace.h (strace): Add 'execing' flag.
-rw-r--r-- | winsup/cygwin/ChangeLog | 12 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/strace.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/path.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 7 | ||||
-rw-r--r-- | winsup/cygwin/strace.cc | 8 |
6 files changed, 27 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3073042..5568069 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +Mon Oct 23 21:47:55 2000 Christopher Faylor <cgf@cygnus.com> + + * exceptions.cc (signal_exit): Kill any executing child process if + we're dying. + * path.h: Remove unneeded extern. + * spawn.cc (std_suffixes): Make static. Don't set dwProcessId here + since it makes the process unsignalable. Set strace flag that this is + an execed process stub. + * strace.cc (strace::vsprntf): Use strace flag to indicate when to + visually flag that this is an exec stub. + * include/sys/strace.h (strace): Add 'execing' flag. + Mon Oct 23 16:43:33 2000 Christopher Faylor <cgf@cygnus.com> * sigproc.cc (proc_subproc): Don't send a false positive if WNOHANG and diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 0054b1a..38879ee 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1017,6 +1017,8 @@ exit_sig: static void signal_exit (int rc) { + extern HANDLE hExeced; + rc = EXIT_SIGNAL | (rc << 8); if (exit_already++) myself->exit (rc); @@ -1035,6 +1037,9 @@ signal_exit (int rc) user_data->resourcelocks->Delete (); user_data->resourcelocks->Init (); + if (hExeced) + TerminateProcess (hExeced, rc); + do_exit (rc); } diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h index d40e3ad..37e9758 100644 --- a/winsup/cygwin/include/sys/strace.h +++ b/winsup/cygwin/include/sys/strace.h @@ -30,6 +30,7 @@ public: int version; int active; int lmicrosec; + int execing; strace() : version(1) {} void prntf (unsigned, const char *func, const char *, ...); void wm (int message, int word, int lon); diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index bef28fe..14367c7 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -103,8 +103,6 @@ class path_conv /* Maximum depth of symlinks (after which ELOOP is issued). */ #define MAX_LINK_DEPTH 10 -extern suffix_info std_suffixes[]; - int __stdcall get_device_number (const char *name, int &unit, BOOL from_conv = FALSE); int __stdcall slash_unc_prefix_p (const char *path); int __stdcall check_null_empty_path (const char *name); diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index b4d65ba..3afb45d 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -37,7 +37,7 @@ details. */ #define LINE_BUF_CHUNK (MAX_PATH * 2) -suffix_info std_suffixes[] = +static suffix_info std_suffixes[] = { suffix_info (".exe", 1), suffix_info ("", 1), suffix_info (".com"), suffix_info (".cmd"), @@ -45,6 +45,8 @@ suffix_info std_suffixes[] = suffix_info (NULL) }; +HANDLE hExeced; + /* Add .exe to PROG if not already present and see if that exists. If not, return PROG (converted from posix to win32 rules if necessary). The result is always BUF. @@ -671,7 +673,8 @@ skip_arg_parsing: /* These are both duplicated in the child code. We do this here, primarily for strace. */ strcpy (myself->progname, real_path); - myself->dwProcessId = pi.dwProcessId; + strace.execing = 1; + hExeced = pi.hProcess; } else { diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index 41c436e..d13596e 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -133,10 +133,8 @@ strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap) if ((p = strrchr (progname, '.')) != NULL && strcasematch (p, ".exe")) *p = '\000'; p = progname; - count = __small_sprintf (buf, fmt, p && *p ? p : "?", - myself->pid, - myself->dwProcessId != GetCurrentProcessId () - ? "!" : ""); + count = __small_sprintf (buf, fmt, p && *p ? p : "?", myself->pid, + execing ? "!" : ""); if (func) count += getfunc (buf + count, func); } @@ -177,6 +175,8 @@ strace::write (unsigned category, const char *buf, int count) __small_sprintf (outbuf, "cYg%08x", strlen (outstuff) + 1); outstuff[-1] = ' '; OutputDebugString (outbuf); +#undef outstuff +#undef PREFIX } /* Printf function used when tracing system calls. |