From 8e453911882c8d97ac0bf6370596ed3830f8e1f6 Mon Sep 17 00:00:00 2001 From: Marco S Hyman Date: Mon, 7 Oct 2002 22:36:05 +0000 Subject: 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. --- lib/libc_r/uthread/uthread_sig.c | 12 ++++++++++-- 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 * 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 * 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 -- cgit v1.2.3