From 606ff664074a9afe96aeea6375de4f6e39755acc Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 17 Aug 2012 23:40:15 +0200 Subject: [PATCH] Noux: Toggle syscall tracing via config Noux used to trace syscalls by default, which significantly slows down its execution. This patch disables the tracing by default. It can be enabled by specifying 'trace_syscalls="yes"' attribute to the Noux configuration. --- ports/src/noux/main.cc | 48 +++++++++++------------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/ports/src/noux/main.cc b/ports/src/noux/main.cc index acd16eb408..96b08a6c9c 100644 --- a/ports/src/noux/main.cc +++ b/ports/src/noux/main.cc @@ -11,34 +11,6 @@ * under the terms of the GNU General Public License version 2. */ -/* - * TODO - * - * ;- Child class - * ;- Pass args and env to child - * ;- Receive args by child - * ;- run 'echo hello' - * ;- run 'seq 10' - * ;- skeleton of noux RPC interface - * ;- run 'pwd' - * ;- move _write->LOG to libc plugin - * ;- stdio (implementation of _write) - * ;- vfs - * ;- TAR file system - * ;- run 'ls -lRa' (dirent syscall) - * ;- run 'cat' (read syscall) - * ;- execve - * ;- fork - * ;- pipe - * ;- read init binary from vfs - * ;- import env into child (execve and fork) - * ;- shell - * - debug 'find' - * ;- stacked file system infrastructure - * ;- TMP file system - * ;- RAM service using a common quota pool - */ - /* Genode includes */ #include #include @@ -53,7 +25,7 @@ #include -enum { verbose_syscall = true }; +static bool trace_syscalls = false; namespace Noux { @@ -64,20 +36,18 @@ namespace Noux { void init_process_exited() { init_child = 0; } }; - -extern "C" void wait_for_continue(); - extern void (*close_socket)(int); extern void init_network(); + /***************************** ** Noux syscall dispatcher ** *****************************/ bool Noux::Child::syscall(Noux::Session::Syscall sc) { - if (verbose_syscall) + if (trace_syscalls) Genode::printf("PID %d -> SYSCALL %s\n", pid(), Noux::Session::syscall_name(sc)); @@ -476,9 +446,9 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc) case SYSCALL_SHUTDOWN: case SYSCALL_CONNECT: case SYSCALL_GETADDRINFO: - { - return _syscall_net(sc); - } + + return _syscall_net(sc); + case SYSCALL_INVALID: break; } } @@ -621,12 +591,18 @@ int main(int argc, char **argv) static Genode::Cap_connection cap; + /* obtain global configuration */ + try { + trace_syscalls = config()->xml_node().attribute("trace_syscalls").has_value("yes"); + } catch (Xml_node::Nonexistent_attribute) { } + /* initialize virtual file system */ static Dir_file_system root_dir(config()->xml_node().sub_node("fstab")); /* initialize network */ init_network(); + /* * Entrypoint used to virtualize child resources such as RAM, RM */