From 4b140a52027d0df0af9d5fb7f79baca826cf5e3b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 6 Nov 2012 17:32:30 +0100 Subject: [PATCH] Define SIGUSR1 for hybrid Linux/Genode programs This patch fixes the 'lx_hybrid_pthread_ipc.run' test. In order to use the 'Genode::Lock' we need to set the SIGUSR1 handler to an empty handler. Normally, this happens when creating a thread via the Genode API. But as this test creates a thread via the pthread library and thereby bypasses the Genode API, the signal handler remained unset. --- base-linux/src/platform/lx_hybrid.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/base-linux/src/platform/lx_hybrid.cc b/base-linux/src/platform/lx_hybrid.cc index d761795e7..3646bca7f 100644 --- a/base-linux/src/platform/lx_hybrid.cc +++ b/base-linux/src/platform/lx_hybrid.cc @@ -40,6 +40,8 @@ int genode___cxa_atexit(void (*func)(void*), void *arg, void *dso) extern char **environ; extern char **lx_environ; +static void empty_signal_handler(int) { } + /* * This function must be called before any other static constructor in the Genode * application, so it gets the highest priority (lowest priority number >100) @@ -47,6 +49,12 @@ extern char **lx_environ; __attribute__((constructor(101))) void lx_hybrid_init() { lx_environ = environ; + + /* + * Set signal handler such that canceled system calls get not + * transparently retried after a signal gets received. + */ + lx_sigaction(LX_SIGUSR1, empty_signal_handler); } /* @@ -158,9 +166,6 @@ namespace Genode { } -static void empty_signal_handler(int) { } - - /** * Return Linux-specific extension of the Env::CPU session interface */