Boost logo

Boost-Commit :

From: kbelco_at_[hidden]
Date: 2007-09-24 17:01:47


Author: noel_belcourt
Date: 2007-09-24 17:01:45 EDT (Mon, 24 Sep 2007)
New Revision: 39514
URL: http://svn.boost.org/trac/boost/changeset/39514

Log:
Fix a problem with the -lx timeout code on ppc darwin.
The intel based darwin system was killing subprocesses
okay but for some reason, ppc systems were not. This
change fixes the timeout code so subprocesses are
properly killed on ppc darwin systems.

Text files modified:
   trunk/tools/jam/src/execunix.c | 13 ++++++-------
   1 files changed, 6 insertions(+), 7 deletions(-)

Modified: trunk/tools/jam/src/execunix.c
==============================================================================
--- trunk/tools/jam/src/execunix.c (original)
+++ trunk/tools/jam/src/execunix.c 2007-09-24 17:01:45 EDT (Mon, 24 Sep 2007)
@@ -212,16 +212,15 @@
             else
                 dup2(err[1], STDERR_FILENO);
 
- /* Make this process a session leader
+ /* Make this process a process group leader
              * so that when we kill it, all child
              * processes of this process are terminated
              * as well.
              *
- * we use kill(-pid, SIGKILL) to kill the
- * session leader and all children of this
- * session.
+ * we use killpg(pid, SIGKILL) to kill the
+ * process group leader and all its children.
              */
- setsid();
+ setpgid(cmdtab[slot].pid, cmdtab[slot].pid);
 
             execvp( argv[0], argv );
             _exit(127);
@@ -379,7 +378,7 @@
             struct tms buf;
             clock_t current = times(&buf);
             if (globs.timeout <= (current-cmdtab[i].start_time)/tps) {
- kill(-cmdtab[i].pid, SIGKILL);
+ killpg(cmdtab[i].pid, SIGKILL);
                 cmdtab[i].exit_reason = EXIT_TIMEOUT;
             }
         }
@@ -418,7 +417,7 @@
             tv.tv_sec = globs.timeout;
             tv.tv_usec = 0;
 
- /* select will wait until io on a descriptor or a signal */
+ /* select will wait until: io on a descriptor, a signal, or we time out */
             ret = select(fd_max+1, &fds, 0, 0, &tv);
         }
         else {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk