From: Martin Mares Date: Sat, 19 Jan 2008 09:50:24 +0000 (+0100) Subject: Added a switch for manual control of syscall actions. X-Git-Tag: python-dummy-working~256 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=d9767ff852b6bae9fa3319d1da812f86a4d54b91;p=moe.git Added a switch for manual control of syscall actions. --- diff --git a/src/box.c b/src/box.c index 11ab37e..c80fe3d 100644 --- a/src/box.c +++ b/src/box.c @@ -221,9 +221,46 @@ static int syscall_by_name(char *name) { for (unsigned int i=0; i= NUM_ACTIONS) + return NUM_ACTIONS; + return l; +} + +static int +set_action(char *a) +{ + char *sep = strchr(a, '='); + enum syscall_action act = SC_YES; + if (sep) + { + *sep++ = 0; + if (!strcmp(sep, "yes")) + act = SC_YES; + else if (!strcmp(sep, "no")) + act = SC_NO; + else if (!strcmp(sep, "file")) + act = SC_FILENAME; + else + return 0; + } + + int sys = syscall_by_name(a); + if (sys < 0) + die("Unknown syscall `%s'", a); + if (sys >= (int)NUM_ACTIONS) + die("Syscall `%s' out of range", a); + syscall_action[sys] = act; + return 1; } static void @@ -583,6 +620,8 @@ Options:\n\ -i \tRedirect stdin from \n\ -m \tLimit address space to KB\n\ -o \tRedirect stdout to \n\ +-s \tPermit the specified syscall (be careful)\n\ +-s =\tDefine action for the specified syscall (=yes/no/file)\n\ -t