diff options
author | Marco S Hyman <marc@cvs.openbsd.org> | 2002-10-07 22:36:05 +0000 |
---|---|---|
committer | Marco S Hyman <marc@cvs.openbsd.org> | 2002-10-07 22:36:05 +0000 |
commit | 8e453911882c8d97ac0bf6370596ed3830f8e1f6 (patch) | |
tree | 2568b07901b463526ba8a3ecab36b5dbfd699beb | |
parent | a30a1a4c9478acfbf5b611ad5b4d5cf1d466bb1c (diff) |
handle the SA_RESETHAND flag.
Part of the prep for SA_SIGINFO support. With this change the
new siginfo regression test will fail instead of loop on all arches.
-rw-r--r-- | lib/libc_r/uthread/uthread_sig.c | 12 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_sig.c | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c index fd49684c955..48f360f3ea3 100644 --- a/lib/libc_r/uthread/uthread_sig.c +++ b/lib/libc_r/uthread/uthread_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_sig.c,v 1.12 2001/12/31 18:23:15 fgsch Exp $ */ +/* $OpenBSD: uthread_sig.c,v 1.13 2002/10/07 22:36:04 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -378,6 +378,7 @@ void _dispatch_signals() { struct pthread *curthread = _get_curthread(); + void (*action)(int, siginfo_t *, void *); int i; /* @@ -395,14 +396,21 @@ _dispatch_signals() _thread_sigact[i - 1].sa_handler != SIG_IGN && sigismember(&curthread->sigpend,i) && !sigismember(&curthread->sigmask,i)) { + action = _thread_sigact[i - 1].sa_sigaction; + /* Clear the pending signal: */ sigdelset(&curthread->sigpend,i); + /* clear custom handler if SA_RESETHAND set. */ + if (_thread_sigact[i - 1].sa_flags & + SA_RESETHAND) + _thread_sigact[i - 1].sa_handler = + SIG_DFL; /* * Dispatch the signal via the custom signal * handler: */ - (*(_thread_sigact[i - 1].sa_handler))(i); + (*action)(i, 0, 0); } } #endif diff --git a/lib/libpthread/uthread/uthread_sig.c b/lib/libpthread/uthread/uthread_sig.c index fd49684c955..48f360f3ea3 100644 --- a/lib/libpthread/uthread/uthread_sig.c +++ b/lib/libpthread/uthread/uthread_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_sig.c,v 1.12 2001/12/31 18:23:15 fgsch Exp $ */ +/* $OpenBSD: uthread_sig.c,v 1.13 2002/10/07 22:36:04 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -378,6 +378,7 @@ void _dispatch_signals() { struct pthread *curthread = _get_curthread(); + void (*action)(int, siginfo_t *, void *); int i; /* @@ -395,14 +396,21 @@ _dispatch_signals() _thread_sigact[i - 1].sa_handler != SIG_IGN && sigismember(&curthread->sigpend,i) && !sigismember(&curthread->sigmask,i)) { + action = _thread_sigact[i - 1].sa_sigaction; + /* Clear the pending signal: */ sigdelset(&curthread->sigpend,i); + /* clear custom handler if SA_RESETHAND set. */ + if (_thread_sigact[i - 1].sa_flags & + SA_RESETHAND) + _thread_sigact[i - 1].sa_handler = + SIG_DFL; /* * Dispatch the signal via the custom signal * handler: */ - (*(_thread_sigact[i - 1].sa_handler))(i); + (*action)(i, 0, 0); } } #endif |