Module Name:    src
Committed By:   jmcneill
Date:           Tue Dec 27 20:59:24 UTC 2011

Modified Files:
        src/sys/arch/usermode/usermode: thunk.c

Log Message:
implement thunk_signal using sigaction so we ensure all of our signal
handlers run on the alternate signal stack


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/usermode/usermode/thunk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.54 src/sys/arch/usermode/usermode/thunk.c:1.55
--- src/sys/arch/usermode/usermode/thunk.c:1.54	Mon Dec 26 21:06:42 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Tue Dec 27 20:59:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.54 2011/12/26 21:06:42 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.55 2011/12/27 20:59:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.54 2011/12/26 21:06:42 jmcneill Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.55 2011/12/27 20:59:24 jmcneill Exp $");
 #endif
 
 #include <sys/types.h>
@@ -507,7 +507,12 @@ thunk_sigaltstack(const stack_t *ss, sta
 void
 thunk_signal(int sig, void (*func)(int))
 {
-	signal(sig, func);
+	struct sigaction sa;
+
+	sa.sa_flags = SA_RESTART | SA_ONSTACK;
+	sa.sa_sigaction = (void (*)(int, siginfo_t *, void *))func;
+	sigemptyset(&sa.sa_mask);
+	sigaction(sig, &sa, NULL);
 }
 
 int

Reply via email to