From 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 27 Mar 2012 11:51:08 +0200 Subject: reorganize file structure to match the upstream requirements --- pintos-progos/utils/setitimer-helper.c | 49 ---------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 pintos-progos/utils/setitimer-helper.c (limited to 'pintos-progos/utils/setitimer-helper.c') diff --git a/pintos-progos/utils/setitimer-helper.c b/pintos-progos/utils/setitimer-helper.c deleted file mode 100644 index 772d736..0000000 --- a/pintos-progos/utils/setitimer-helper.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -int -main (int argc, char *argv[]) -{ - const char *program_name = argv[0]; - double timeout; - - if (argc < 3) - { - fprintf (stderr, - "setitimer-helper: runs a program with a virtual CPU limit\n" - "usage: %s TIMEOUT PROGRAM [ARG...]\n" - " where TIMEOUT is the virtual CPU limit, in seconds,\n" - " and remaining arguments specify the program to run\n" - " and its argument.\n", - program_name); - return EXIT_FAILURE; - } - - timeout = strtod (argv[1], NULL); - if (timeout >= 0.0 && timeout < LONG_MAX) - { - struct itimerval it; - - it.it_interval.tv_sec = 0; - it.it_interval.tv_usec = 0; - it.it_value.tv_sec = timeout; - it.it_value.tv_usec = (timeout - floor (timeout)) * 1000000; - if (setitimer (ITIMER_VIRTUAL, &it, NULL) < 0) - fprintf (stderr, "%s: setitimer: %s\n", - program_name, strerror (errno)); - } - else - fprintf (stderr, "%s: invalid timeout value \"%s\"\n", - program_name, argv[1]); - - execvp (argv[2], &argv[2]); - fprintf (stderr, "%s: couldn't exec \"%s\": %s\n", - program_name, argv[2], strerror (errno)); - return EXIT_FAILURE; -} -- cgit v1.2.3