diff --git a/ghc/lib/std/cbits/system.c b/ghc/lib/std/cbits/system.c index 7779139b4b1d465cf0cb9fdc9b12f60e601cf9a5..dddf9936cfdf9819c8edbacbde7b34048303a973 100644 --- a/ghc/lib/std/cbits/system.c +++ b/ghc/lib/std/cbits/system.c @@ -1,7 +1,7 @@ /* * (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 */ @@ -13,6 +13,17 @@ #include #endif +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + #ifndef mingw32_TARGET_OS # ifdef HAVE_SYS_WAIT_H # include @@ -65,9 +76,22 @@ systemCmd(StgByteArray cmd) return -1; } 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 */ execl("/bin/sh", "sh", "-c", cmd, NULL); _exit(127); + } } while (waitpid(pid, &wstat, 0) < 0) {