Commit 635c990e authored by simonmar's avatar simonmar

[project @ 2000-03-17 09:48:48 by simonmar]

Reset the itimers in the child, so it doesn't get plagued by SIGVTALRM
interrupts.

Reported by ADR,
Patch from  Hannah Schroeter <uk1o@rz.uni-karlsruhe.de>.
parent a574c520
/* /*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
* *
* $Id: system.c,v 1.6 1999/12/08 15:47:08 simonmar Exp $ * $Id: system.c,v 1.7 2000/03/17 09:48:48 simonmar Exp $
* *
* system Runtime Support * system Runtime Support
*/ */
...@@ -13,6 +13,17 @@ ...@@ -13,6 +13,17 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#ifndef mingw32_TARGET_OS #ifndef mingw32_TARGET_OS
# ifdef HAVE_SYS_WAIT_H # ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h> # include <sys/wait.h>
...@@ -65,9 +76,22 @@ systemCmd(StgByteArray cmd) ...@@ -65,9 +76,22 @@ systemCmd(StgByteArray cmd)
return -1; return -1;
} }
case 0: case 0:
{
/* Reset the itimers in the child, so it doesn't get plagued
* by SIGVTALRM interrupts.
*/
struct timeval tv_null = { 0, 0 };
struct itimerval itv;
itv.it_interval = tv_null;
itv.it_value = tv_null;
setitimer(ITIMER_REAL, &itv, NULL);
setitimer(ITIMER_VIRTUAL, &itv, NULL);
setitimer(ITIMER_PROF, &itv, NULL);
/* the child */ /* the child */
execl("/bin/sh", "sh", "-c", cmd, NULL); execl("/bin/sh", "sh", "-c", cmd, NULL);
_exit(127); _exit(127);
}
} }
while (waitpid(pid, &wstat, 0) < 0) { while (waitpid(pid, &wstat, 0) < 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment