summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-09-14 22:42:39 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-09-14 22:42:39 +0000
commit40d912b4658ac36049c089f1efe2db7d635f9ff8 (patch)
tree32412160b780a53f365168fb7b35a20b71af5bea
parentb622332e18b29fb3d634953210ec0be4db366373 (diff)
downloadFreeBSD-src-40d912b4658ac36049c089f1efe2db7d635f9ff8.zip
FreeBSD-src-40d912b4658ac36049c089f1efe2db7d635f9ff8.tar.gz
When invoking an old style signal handler, use true traditional BSD style to
invoke signal handler. Reviewed by: deischen
-rw-r--r--lib/libkse/thread/thr_sig.c19
-rw-r--r--lib/libpthread/thread/thr_sig.c19
2 files changed, 26 insertions, 12 deletions
diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c
index cda46f1..1f1f0b4 100644
--- a/lib/libkse/thread/thr_sig.c
+++ b/lib/libkse/thread/thr_sig.c
@@ -299,6 +299,9 @@ sigprop(int sig)
return (0);
}
+typedef void (*ohandler)(int sig, int code,
+ struct sigcontext *scp, char *addr, __sighandler_t *catcher);
+
void
_thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
{
@@ -366,9 +369,11 @@ _thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
(sigfunc != (__siginfohandler_t *)_thr_sig_handler)) {
if ((sa_flags & SA_SIGINFO) != 0 || info == NULL)
(*(sigfunc))(sig, info, ucp);
- else
- (*(sigfunc))(sig, (siginfo_t*)(intptr_t)info->si_code,
- ucp);
+ else {
+ ((ohandler)(*sigfunc))(
+ sig, info->si_code, (struct sigcontext *)ucp,
+ info->si_addr, (__sighandler_t *)sigfunc);
+ }
} else {
if ((__sighandler_t *)sigfunc == SIG_DFL) {
if (sigprop(sig) & SA_KILL) {
@@ -444,9 +449,11 @@ thr_sig_invoke_handler(struct pthread *curthread, int sig, siginfo_t *info,
((__sighandler_t *)sigfunc != SIG_IGN)) {
if ((sa_flags & SA_SIGINFO) != 0 || info == NULL)
(*(sigfunc))(sig, info, ucp);
- else
- (*(sigfunc))(sig, (siginfo_t*)(intptr_t)info->si_code,
- ucp);
+ else {
+ ((ohandler)(*sigfunc))(
+ sig, info->si_code, (struct sigcontext *)ucp,
+ info->si_addr, (__sighandler_t *)sigfunc);
+ }
} else {
if ((__sighandler_t *)sigfunc == SIG_DFL) {
if (sigprop(sig) & SA_KILL) {
diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c
index cda46f1..1f1f0b4 100644
--- a/lib/libpthread/thread/thr_sig.c
+++ b/lib/libpthread/thread/thr_sig.c
@@ -299,6 +299,9 @@ sigprop(int sig)
return (0);
}
+typedef void (*ohandler)(int sig, int code,
+ struct sigcontext *scp, char *addr, __sighandler_t *catcher);
+
void
_thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
{
@@ -366,9 +369,11 @@ _thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
(sigfunc != (__siginfohandler_t *)_thr_sig_handler)) {
if ((sa_flags & SA_SIGINFO) != 0 || info == NULL)
(*(sigfunc))(sig, info, ucp);
- else
- (*(sigfunc))(sig, (siginfo_t*)(intptr_t)info->si_code,
- ucp);
+ else {
+ ((ohandler)(*sigfunc))(
+ sig, info->si_code, (struct sigcontext *)ucp,
+ info->si_addr, (__sighandler_t *)sigfunc);
+ }
} else {
if ((__sighandler_t *)sigfunc == SIG_DFL) {
if (sigprop(sig) & SA_KILL) {
@@ -444,9 +449,11 @@ thr_sig_invoke_handler(struct pthread *curthread, int sig, siginfo_t *info,
((__sighandler_t *)sigfunc != SIG_IGN)) {
if ((sa_flags & SA_SIGINFO) != 0 || info == NULL)
(*(sigfunc))(sig, info, ucp);
- else
- (*(sigfunc))(sig, (siginfo_t*)(intptr_t)info->si_code,
- ucp);
+ else {
+ ((ohandler)(*sigfunc))(
+ sig, info->si_code, (struct sigcontext *)ucp,
+ info->si_addr, (__sighandler_t *)sigfunc);
+ }
} else {
if ((__sighandler_t *)sigfunc == SIG_DFL) {
if (sigprop(sig) & SA_KILL) {
OpenPOWER on IntegriCloud