2 * (c) The University of Glasgow 2002
4 * $Id: system.c,v 1.7 2003/02/04 11:55:54 simonmar Exp $
6 * system Runtime Support
9 /* The itimer stuff in this module is non-posix */
10 // #include "PosixSource.h"
14 #if defined(mingw32_TARGET_OS)
30 /* -------------------- WINDOWS VERSION --------------------- */
31 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
34 /* -------------------- UNIX VERSION --------------------- */
38 switch(pid = fork()) {
46 /* Reset the itimers in the child, so it doesn't get plagued
47 * by SIGVTALRM interrupts.
49 struct timeval tv_null = { 0, 0 };
51 itv.it_interval = tv_null;
52 itv.it_value = tv_null;
53 setitimer(ITIMER_REAL, &itv, NULL);
54 setitimer(ITIMER_VIRTUAL, &itv, NULL);
55 setitimer(ITIMER_PROF, &itv, NULL);
59 execl("/bin/sh", "sh", "-c", cmd, NULL);
64 while (waitpid(pid, &wstat, 0) < 0) {
71 return WEXITSTATUS(wstat);
72 else if (WIFSIGNALED(wstat)) {
76 /* This should never happen */