summaryrefslogtreecommitdiffstats
path: root/lib/libc_r
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc_r')
-rw-r--r--lib/libc_r/uthread/pthread_private.h10
-rw-r--r--lib/libc_r/uthread/uthread_fork.c2
-rw-r--r--lib/libc_r/uthread/uthread_info.c10
-rw-r--r--lib/libc_r/uthread/uthread_kern.c2
-rw-r--r--lib/libc_r/uthread/uthread_sig.c12
-rw-r--r--lib/libc_r/uthread/uthread_sigmask.c7
-rw-r--r--lib/libc_r/uthread/uthread_sigprocmask.c7
-rw-r--r--lib/libc_r/uthread/uthread_sigwait.c4
8 files changed, 37 insertions, 17 deletions
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h
index c6c1100..a58c02f 100644
--- a/lib/libc_r/uthread/pthread_private.h
+++ b/lib/libc_r/uthread/pthread_private.h
@@ -499,7 +499,7 @@ struct pthread {
* Saved signal context used in call to sigreturn by
* _thread_kern_sched if sig_saved is TRUE.
*/
- struct sigcontext saved_sigcontext;
+ ucontext_t saved_sigcontext;
/*
* Saved jump buffer used in call to longjmp by _thread_kern_sched
@@ -954,15 +954,15 @@ void *_thread_cleanup(pthread_t);
void _thread_cleanupspecific(void);
void _thread_dump_info(void);
void _thread_init(void);
-void _thread_kern_sched(struct sigcontext *);
+void _thread_kern_sched(ucontext_t *);
void _thread_kern_sched_state(enum pthread_state,char *fname,int lineno);
void _thread_kern_sched_state_unlock(enum pthread_state state,
spinlock_t *lock, char *fname, int lineno);
void _thread_kern_set_timeout(struct timespec *);
void _thread_kern_sig_defer(void);
void _thread_kern_sig_undefer(void);
-void _thread_sig_handler(int, int, struct sigcontext *);
-void _thread_sig_handle(int, struct sigcontext *);
+void _thread_sig_handler(int, int, ucontext_t *);
+void _thread_sig_handle(int, ucontext_t *);
void _thread_sig_init(void);
void _thread_start(void);
void _thread_start_sig_handler(void);
@@ -977,7 +977,7 @@ int _thread_sys_sigprocmask(int, const sigset_t *, sigset_t *);
int _thread_sys_sigsuspend(const sigset_t *);
int _thread_sys_siginterrupt(int, int);
int _thread_sys_sigpause(int);
-int _thread_sys_sigreturn(struct sigcontext *);
+int _thread_sys_sigreturn(ucontext_t *);
int _thread_sys_sigstack(const struct sigstack *, struct sigstack *);
int _thread_sys_sigvec(int, struct sigvec *, struct sigvec *);
void _thread_sys_psignal(unsigned int, const char *);
diff --git a/lib/libc_r/uthread/uthread_fork.c b/lib/libc_r/uthread/uthread_fork.c
index 93d4a68..155416e 100644
--- a/lib/libc_r/uthread/uthread_fork.c
+++ b/lib/libc_r/uthread/uthread_fork.c
@@ -62,7 +62,7 @@ fork(void)
_thread_sys_close(_thread_kern_pipe[1]);
/* Reset signals pending for the running thread: */
- _thread_run->sigpend = 0;
+ sigemptyset(&_thread_run->sigpend);
/*
* Create a pipe that is written to by the signal handler to
diff --git a/lib/libc_r/uthread/uthread_info.c b/lib/libc_r/uthread/uthread_info.c
index ed4a58d..06b556e 100644
--- a/lib/libc_r/uthread/uthread_info.c
+++ b/lib/libc_r/uthread/uthread_info.c
@@ -156,8 +156,14 @@ _thread_dump_info(void)
_thread_sys_write(fd, s, strlen(s));
break;
case PS_SIGWAIT:
- snprintf(s, sizeof(s), "sigmask 0x%08lx\n",
- (unsigned long)pthread->sigmask);
+ snprintf(s, sizeof(s), "sigmask (hi)");
+ _thread_sys_write(fd, s, strlen(s));
+ for (i = _SIG_WORDS - 1; i >= 0; i--) {
+ snprintf(s, sizeof(s), "%08x\n",
+ pthread->sigmask.__bits[i]);
+ _thread_sys_write(fd, s, strlen(s));
+ }
+ snprintf(s, sizeof(s), "(lo)\n");
_thread_sys_write(fd, s, strlen(s));
break;
diff --git a/lib/libc_r/uthread/uthread_kern.c b/lib/libc_r/uthread/uthread_kern.c
index 3331a5d..a4717fa 100644
--- a/lib/libc_r/uthread/uthread_kern.c
+++ b/lib/libc_r/uthread/uthread_kern.c
@@ -61,7 +61,7 @@ static inline void
thread_run_switch_hook(pthread_t thread_out, pthread_t thread_in);
void
-_thread_kern_sched(struct sigcontext * scp)
+_thread_kern_sched(ucontext_t * scp)
{
#ifndef __alpha__
char *fdata;
diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c
index b6aad9c..3f31a34 100644
--- a/lib/libc_r/uthread/uthread_sig.c
+++ b/lib/libc_r/uthread/uthread_sig.c
@@ -31,6 +31,9 @@
*
* $FreeBSD$
*/
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/signalvar.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
@@ -62,7 +65,7 @@ _thread_sig_init(void)
}
void
-_thread_sig_handler(int sig, int code, struct sigcontext * scp)
+_thread_sig_handler(int sig, int code, ucontext_t * scp)
{
char c;
int i;
@@ -148,7 +151,7 @@ _thread_sig_handler(int sig, int code, struct sigcontext * scp)
}
void
-_thread_sig_handle(int sig, struct sigcontext * scp)
+_thread_sig_handle(int sig, ucontext_t * scp)
{
int i;
pthread_t pthread, pthread_next;
@@ -360,13 +363,16 @@ _thread_signal(pthread_t pthread, int sig)
void
_dispatch_signals()
{
+ sigset_t sigset;
int i;
/*
* Check if there are pending signals for the running
* thread that aren't blocked:
*/
- if ((_thread_run->sigpend & ~_thread_run->sigmask) != 0)
+ sigset = _thread_run->sigpend;
+ SIGSETNAND(sigset, _thread_run->sigmask);
+ if (SIGNOTEMPTY(sigset))
/* Look for all possible pending signals: */
for (i = 1; i < NSIG; i++)
/*
diff --git a/lib/libc_r/uthread/uthread_sigmask.c b/lib/libc_r/uthread/uthread_sigmask.c
index 514f8fa..b880d9c 100644
--- a/lib/libc_r/uthread/uthread_sigmask.c
+++ b/lib/libc_r/uthread/uthread_sigmask.c
@@ -31,6 +31,9 @@
*
* $FreeBSD$
*/
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/signalvar.h>
#include <errno.h>
#include <signal.h>
#ifdef _THREAD_SAFE
@@ -54,13 +57,13 @@ pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
/* Block signals: */
case SIG_BLOCK:
/* Add signals to the existing mask: */
- _thread_run->sigmask |= *set;
+ SIGSETOR(_thread_run->sigmask, *set);
break;
/* Unblock signals: */
case SIG_UNBLOCK:
/* Clear signals from the existing mask: */
- _thread_run->sigmask &= ~(*set);
+ SIGSETNAND(_thread_run->sigmask, *set);
break;
/* Set the signal process mask: */
diff --git a/lib/libc_r/uthread/uthread_sigprocmask.c b/lib/libc_r/uthread/uthread_sigprocmask.c
index 9455922..592a61e 100644
--- a/lib/libc_r/uthread/uthread_sigprocmask.c
+++ b/lib/libc_r/uthread/uthread_sigprocmask.c
@@ -31,6 +31,9 @@
*
* $FreeBSD$
*/
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/signalvar.h>
#include <signal.h>
#include <errno.h>
#ifdef _THREAD_SAFE
@@ -54,13 +57,13 @@ sigprocmask(int how, const sigset_t * set, sigset_t * oset)
/* Block signals: */
case SIG_BLOCK:
/* Add signals to the existing mask: */
- _thread_run->sigmask |= *set;
+ SIGSETOR(_thread_run->sigmask, *set);
break;
/* Unblock signals: */
case SIG_UNBLOCK:
/* Clear signals from the existing mask: */
- _thread_run->sigmask &= ~(*set);
+ SIGSETNAND(_thread_run->sigmask, *set);
break;
/* Set the signal process mask: */
diff --git a/lib/libc_r/uthread/uthread_sigwait.c b/lib/libc_r/uthread/uthread_sigwait.c
index 7257b7e..96a1e15 100644
--- a/lib/libc_r/uthread/uthread_sigwait.c
+++ b/lib/libc_r/uthread/uthread_sigwait.c
@@ -68,7 +68,9 @@ sigwait(const sigset_t * set, int *sig)
sigdelset(&waitset, SIGINFO);
/* Check to see if a pending signal is in the wait mask. */
- if (tempset = (_thread_run->sigpend & waitset)) {
+ tempset = _thread_run->sigpend;
+ SIGSETAND(tempset, waitset);
+ if (SIGNOTEMPTY(tempset)) {
/* Enter a loop to find a pending signal: */
for (i = 1; i < NSIG; i++) {
if (sigismember (&tempset, i))
OpenPOWER on IntegriCloud