2 * (c) The University of Glasgow 2002
4 * $Id: system.c,v 1.6 2002/03/26 21:02:19 sof 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)
22 /* -------------------- WINDOWS VERSION --------------------- */
23 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
26 /* -------------------- UNIX VERSION --------------------- */
30 switch(pid = fork()) {
38 /* Reset the itimers in the child, so it doesn't get plagued
39 * by SIGVTALRM interrupts.
41 struct timeval tv_null = { 0, 0 };
43 itv.it_interval = tv_null;
44 itv.it_value = tv_null;
45 setitimer(ITIMER_REAL, &itv, NULL);
46 setitimer(ITIMER_VIRTUAL, &itv, NULL);
47 setitimer(ITIMER_PROF, &itv, NULL);
51 execl("/bin/sh", "sh", "-c", cmd, NULL);
56 while (waitpid(pid, &wstat, 0) < 0) {
63 return WEXITSTATUS(wstat);
64 else if (WIFSIGNALED(wstat)) {
68 /* This should never happen */