From d9767ff852b6bae9fa3319d1da812f86a4d54b91 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 19 Jan 2008 10:50:24 +0100 Subject: [PATCH] Added a switch for manual control of syscall actions. --- src/box.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) 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