Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode/usermode implement thunk_signal using siga...



details:   https://anonhg.NetBSD.org/src/rev/2938ba9742af
branches:  trunk
changeset: 772284:2938ba9742af
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Dec 27 20:59:24 2011 +0000

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

diffstat:

 sys/arch/usermode/usermode/thunk.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 0127fce6fde2 -r 2938ba9742af sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Tue Dec 27 20:29:08 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Tue Dec 27 20:59:24 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index