summaryrefslogtreecommitdiffstats
path: root/lib/libkse
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>1999-09-29 15:18:46 +0000
committermarcel <marcel@FreeBSD.org>1999-09-29 15:18:46 +0000
commit5bf7ce284b3edfc7459435005d0f04edf673cb6f (patch)
tree81a2f1cf31c40a034fe5b493fc79d27fda808958 /lib/libkse
parentbd000d73ad75473ad7201663ffb27c36ab130f0e (diff)
downloadFreeBSD-src-5bf7ce284b3edfc7459435005d0f04edf673cb6f.zip
FreeBSD-src-5bf7ce284b3edfc7459435005d0f04edf673cb6f.tar.gz
sigset_t change (part 5 of 5)
----------------------------- Most of the userland changes are in libc. For both the alpha and the i386 setjmp has been changed to accomodate for the new sigset_t. Internally, libc is mostly rewritten to use the new syscalls. The exception is in compat-43/sigcompat.c The POSIX thread library has also been rewritten to use the new sigset_t. Except, that it currently only handles NSIG signals instead of the maximum _SIG_MAXSIG. This should not be a problem because current applications don't use any signals higher than NSIG. There are version bumps for the following libraries: libdialog libreadline libc libc_r libedit libftpio libss These libraries either a) have one of the modified structures visible in the interface, or b) use sigset_t internally and may cause breakage if new binaries are used against libraries that don't have the sigset_t change. This not an immediate issue, but will be as soon as applications start using the new range to its fullest. NOTE: libncurses already had an version bump and has not been given one now. NOTE: doscmd is a real casualty and has been disconnected for the moment. Reconnection will eventually happen after doscmd has been fixed. I'm aware that being the last one to touch it, I'm automaticly promoted to being maintainer. According to good taste this means that I will receive a badge which either will be glued or mechanically stapled, drilled or otherwise violently forced onto me :-) NOTE: pcvt/vttest cannot be compiled with -traditional. The change cause sys/types to be included along the way which contains the const and volatile modifiers. I don't consider this a solution, but more a workaround.
Diffstat (limited to 'lib/libkse')
-rw-r--r--lib/libkse/thread/thr_fork.c2
-rw-r--r--lib/libkse/thread/thr_info.c10
-rw-r--r--lib/libkse/thread/thr_kern.c2
-rw-r--r--lib/libkse/thread/thr_private.h10
-rw-r--r--lib/libkse/thread/thr_sig.c12
-rw-r--r--lib/libkse/thread/thr_sigmask.c7
-rw-r--r--lib/libkse/thread/thr_sigprocmask.c7
-rw-r--r--lib/libkse/thread/thr_sigwait.c4
8 files changed, 37 insertions, 17 deletions
diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c
index 93d4a68..155416e 100644
--- a/lib/libkse/thread/thr_fork.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_info.c b/lib/libkse/thread/thr_info.c
index ed4a58d..06b556e 100644
--- a/lib/libkse/thread/thr_info.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c
index 3331a5d..a4717fa 100644
--- a/lib/libkse/thread/thr_kern.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_private.h b/lib/libkse/thread/thr_private.h
index c6c1100..a58c02f 100644
--- a/lib/libkse/thread/thr_private.h
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c
index b6aad9c..3f31a34 100644
--- a/lib/libkse/thread/thr_sig.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_sigmask.c b/lib/libkse/thread/thr_sigmask.c
index 514f8fa..b880d9c 100644
--- a/lib/libkse/thread/thr_sigmask.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_sigprocmask.c b/lib/libkse/thread/thr_sigprocmask.c
index 9455922..592a61e 100644
--- a/lib/libkse/thread/thr_sigprocmask.c
+++ b/lib/libkse/thread/thr_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/libkse/thread/thr_sigwait.c b/lib/libkse/thread/thr_sigwait.c
index 7257b7e..96a1e15 100644
--- a/lib/libkse/thread/thr_sigwait.c
+++ b/lib/libkse/thread/thr_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