summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-08-20 13:43:35 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-08-20 13:43:35 +0000
commit5546ba50272e71097a2f7c6b9fbec902cf58c4ea (patch)
tree3cd1b354b573995c2d5791aab5f5469af5ed64ba /lib
parent06152c89ae152b1f399c1796a718a428992b7f5f (diff)
downloadFreeBSD-src-5546ba50272e71097a2f7c6b9fbec902cf58c4ea.zip
FreeBSD-src-5546ba50272e71097a2f7c6b9fbec902cf58c4ea.tar.gz
_thr_sig_check_pending is also called by scope system thread when it leaves
critical region, we wrap some syscalls for thread cancellation point, and when syscalls returns, we call _thr_leave_cancellation_point, at the time if a signal comes in, it would be buffered, and when the thread leaves _thr_leave_cancellation_point, buffered signals will be processed, to avoid messing up normal syscall errno, we should save and restore errno around signal handling code.
Diffstat (limited to 'lib')
-rw-r--r--lib/libkse/thread/thr_sig.c3
-rw-r--r--lib/libpthread/thread/thr_sig.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c
index 01b0914..26c1317 100644
--- a/lib/libkse/thread/thr_sig.c
+++ b/lib/libkse/thread/thr_sig.c
@@ -750,10 +750,12 @@ _thr_sig_check_pending(struct pthread *curthread)
{
ucontext_t uc;
volatile int once;
+ int errsave;
if (THR_IN_CRITICAL(curthread))
return;
+ errsave = errno;
once = 0;
THR_GETCONTEXT(&uc);
if (once == 0) {
@@ -761,6 +763,7 @@ _thr_sig_check_pending(struct pthread *curthread)
curthread->check_pending = 0;
_thr_sig_rundown(curthread, &uc, NULL);
}
+ errno = errsave;
}
#ifndef SYSTEM_SCOPE_ONLY
diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c
index 01b0914..26c1317 100644
--- a/lib/libpthread/thread/thr_sig.c
+++ b/lib/libpthread/thread/thr_sig.c
@@ -750,10 +750,12 @@ _thr_sig_check_pending(struct pthread *curthread)
{
ucontext_t uc;
volatile int once;
+ int errsave;
if (THR_IN_CRITICAL(curthread))
return;
+ errsave = errno;
once = 0;
THR_GETCONTEXT(&uc);
if (once == 0) {
@@ -761,6 +763,7 @@ _thr_sig_check_pending(struct pthread *curthread)
curthread->check_pending = 0;
_thr_sig_rundown(curthread, &uc, NULL);
}
+ errno = errsave;
}
#ifndef SYSTEM_SCOPE_ONLY
OpenPOWER on IntegriCloud