From 635c990e06073bbb774c55d8f7a36c53436e4db5 Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 17 Mar 2000 09:48:48 +0000 Subject: [PATCH] [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 . --- ghc/lib/std/cbits/system.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/ghc/lib/std/cbits/system.c b/ghc/lib/std/cbits/system.c index 7779139..dddf993 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) { -- 1.7.10.4