aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>1999-09-29 15:18:46 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>1999-09-29 15:18:46 +0000
commit3cf3c5d9ddb2edd1033c0b8e612096b8b35b3bb4 (patch)
treef20b5cb25cf94c494095050b1f52676e7efd71f7
parent956d3333cadea27513348a7718e9cfd5c26e9ba0 (diff)
downloadsrc-3cf3c5d9ddb2edd1033c0b8e612096b8b35b3bb4.tar.gz
src-3cf3c5d9ddb2edd1033c0b8e612096b8b35b3bb4.zip
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.
Notes
Notes: svn path=/head/; revision=51794
-rw-r--r--gnu/lib/libdialog/Makefile2
-rw-r--r--gnu/lib/libreadline/Makefile.inc2
-rw-r--r--include/signal.h63
-rw-r--r--include/ucontext.h36
-rw-r--r--lib/libc/Makefile4
-rw-r--r--lib/libc/alpha/gen/setjmp.S11
-rw-r--r--lib/libc/amd64/gen/_setjmp.S4
-rw-r--r--lib/libc/amd64/gen/setjmp.S30
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S39
-rw-r--r--lib/libc/amd64/sys/Makefile.inc7
-rw-r--r--lib/libc/compat-43/sigcompat.c32
-rw-r--r--lib/libc/gen/sigsetops.c33
-rw-r--r--lib/libc/i386/gen/_setjmp.S4
-rw-r--r--lib/libc/i386/gen/setjmp.S30
-rw-r--r--lib/libc/i386/gen/sigsetjmp.S39
-rw-r--r--lib/libc/i386/sys/Makefile.inc7
-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
-rw-r--r--lib/libedit/Makefile5
-rw-r--r--lib/libftpio/Makefile6
-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
-rw-r--r--lib/libpthread/thread/thr_fork.c2
-rw-r--r--lib/libpthread/thread/thr_info.c10
-rw-r--r--lib/libpthread/thread/thr_kern.c2
-rw-r--r--lib/libpthread/thread/thr_private.h10
-rw-r--r--lib/libpthread/thread/thr_sig.c12
-rw-r--r--lib/libpthread/thread/thr_sigmask.c7
-rw-r--r--lib/libpthread/thread/thr_sigprocmask.c7
-rw-r--r--lib/libpthread/thread/thr_sigwait.c4
-rw-r--r--lib/libss/Makefile3
-rw-r--r--usr.bin/Makefile2
-rw-r--r--usr.sbin/pcvt/vttest/Makefile5
-rw-r--r--usr.sbin/rpc.statd/statd.c2
46 files changed, 372 insertions, 156 deletions
diff --git a/gnu/lib/libdialog/Makefile b/gnu/lib/libdialog/Makefile
index 284409a88a61..89faa5c8b8c5 100644
--- a/gnu/lib/libdialog/Makefile
+++ b/gnu/lib/libdialog/Makefile
@@ -4,7 +4,7 @@
LIB= dialog
MAN3= dialog.3
-SHLIB_MAJOR= 3
+SHLIB_MAJOR= 4
SHLIB_MINOR= 0
SRCS= kernel.c rc.c checklist.c inputbox.c menubox.c msgbox.c \
lineedit.c radiolist.c textbox.c yesno.c prgbox.c raw_popen.c \
diff --git a/gnu/lib/libreadline/Makefile.inc b/gnu/lib/libreadline/Makefile.inc
index 0dd7746254d0..3ecbca1938e4 100644
--- a/gnu/lib/libreadline/Makefile.inc
+++ b/gnu/lib/libreadline/Makefile.inc
@@ -1,6 +1,6 @@
# $FreeBSD$
-SHLIB_MAJOR= 3
+SHLIB_MAJOR= 4
SHLIB_MINOR= 0
RL_LIBRARY_VERSION= 4.0
diff --git a/include/signal.h b/include/signal.h
index 69832e068d1e..2e846e621f45 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -31,6 +31,8 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.3 (Berkeley) 3/30/94
+ *
+ * $FreeBSD$
*/
#ifndef _SIGNAL_H_
@@ -40,6 +42,7 @@
#include <sys/_posix.h>
#include <machine/ansi.h>
#include <sys/signal.h>
+#include <sys/time.h>
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
extern __const char *__const sys_signame[NSIG];
@@ -67,18 +70,18 @@ int sigwait __P((const sigset_t *, int *));
__BEGIN_DECLS
int sigqueue __P((_BSD_PID_T_, int, const union sigval));
-int sigtimedwait __P((const sigset_t *, siginfo_t *));
+int sigtimedwait __P((const sigset_t *, siginfo_t *, const struct timespec *));
int sigwaitinfo __P((const sigset_t *, siginfo_t *));
__END_DECLS
#endif
#ifndef _POSIX_SOURCE
int killpg __P((_BSD_PID_T_, int));
-int sigaltstack __P((const struct sigaltstack *, struct sigaltstack *));
+int sigaltstack __P((const stack_t *, stack_t *));
int sigblock __P((int));
int siginterrupt __P((int, int));
int sigpause __P((int));
-int sigreturn __P((struct sigcontext *));
+int sigreturn __P((ucontext_t *));
int sigsetmask __P((int));
int sigstack __P((const struct sigstack *, struct sigstack *));
int sigvec __P((int, struct sigvec *, struct sigvec *));
@@ -89,11 +92,55 @@ __END_DECLS
#ifndef _ANSI_SOURCE
/* List definitions after function declarations, or Reiser cpp gets upset. */
-#define sigaddset(set, signo) (*(set) |= 1 << ((signo) - 1), 0)
-#define sigdelset(set, signo) (*(set) &= ~(1 << ((signo) - 1)), 0)
-#define sigemptyset(set) (*(set) = 0, 0)
-#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
-#define sigismember(set, signo) ((*(set) & (1 << ((signo) - 1))) != 0)
+extern __inline int sigaddset(sigset_t *set, int signo)
+{
+
+ if (signo <= 0 || signo > _SIG_MAXSIG) {
+ /* errno = EINVAL; */
+ return (-1);
+ }
+ set->__bits[_SIG_WORD(signo)] |= _SIG_BIT(signo);
+ return (0);
+}
+
+extern __inline int sigdelset(sigset_t *set, int signo)
+{
+
+ if (signo <= 0 || signo > _SIG_MAXSIG) {
+ /* errno = EINVAL; */
+ return (-1);
+ }
+ set->__bits[_SIG_WORD(signo)] &= ~_SIG_BIT(signo);
+ return (0);
+}
+
+extern __inline int sigemptyset(sigset_t *set)
+{
+ int i;
+
+ for (i = 0; i < _SIG_WORDS; i++)
+ set->__bits[i] = 0;
+ return (0);
+}
+
+extern __inline int sigfillset(sigset_t *set)
+{
+ int i;
+
+ for (i = 0; i < _SIG_WORDS; i++)
+ set->__bits[i] = ~(unsigned int)0;
+ return (0);
+}
+
+extern __inline int sigismember(__const sigset_t *set, int signo)
+{
+
+ if (signo <= 0 || signo > _SIG_MAXSIG) {
+ /* errno = EINVAL; */
+ return (-1);
+ }
+ return ((set->__bits[_SIG_WORD(signo)] & _SIG_BIT(signo)) ? 1 : 0);
+}
#endif /* !_ANSI_SOURCE */
#endif /* !_SIGNAL_H_ */
diff --git a/include/ucontext.h b/include/ucontext.h
new file mode 100644
index 000000000000..f868980b79f7
--- /dev/null
+++ b/include/ucontext.h
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 1999 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _UCONTEXT_H_
+#define _UCONTEXT_H_ 1
+
+#include <sys/ucontext.h>
+
+#endif /* _UCONTEXT_H_ */
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 023da6b8bad5..8a2afa830c30 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -7,8 +7,8 @@
# from CFLAGS below. To remove these strings from just the system call
# stubs, remove just -DSYSLIBC_RCS from CFLAGS.
LIB=c
-SHLIB_MAJOR= 3
-SHLIB_MINOR= 1
+SHLIB_MAJOR= 4
+SHLIB_MINOR= 0
CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/include
AINC= -I${.CURDIR}/${MACHINE_ARCH}
CLEANFILES+=tags
diff --git a/lib/libc/alpha/gen/setjmp.S b/lib/libc/alpha/gen/setjmp.S
index a6d10836ae95..ee56d9d02ed6 100644
--- a/lib/libc/alpha/gen/setjmp.S
+++ b/lib/libc/alpha/gen/setjmp.S
@@ -25,6 +25,8 @@
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
+ *
+ * $FreeBSD$
*/
#include "SYS.h"
@@ -61,9 +63,10 @@ LEAF(setjmp, 1)
mov a0, s0 /* squirrel away ptr to sc */
/* see what's blocked */
- mov zero, a0
- PCALL(sigblock) /* see what's blocked */
- stq v0, (1 * 8)(s0) /* and remember it in sc_mask */
+ lda a2, (71 * 8)(a0) /* oset: sc_reserved */
+ mov zero, a1 /* set: NULL */
+ add a1, 1, a0 /* how: SIG_BLOCK */
+ PCALL(sigprocmask) /* see what's blocked */
lda sp, -24(sp) /* sizeof struct sigaltstack */
mov zero, a0
@@ -115,7 +118,7 @@ END(setjmp)
LEAF(longjmp, 2)
LDGP(pv)
stq a1, (( 0 + 4) * 8)(a0) /* save return value */
- PCALL(sigreturn) /* use sigreturn to return */
+ PCALL(osigreturn) /* use sigreturn to return */
botch:
CALL(longjmperror)
diff --git a/lib/libc/amd64/gen/_setjmp.S b/lib/libc/amd64/gen/_setjmp.S
index 39ad5accf47e..c8a1d215acda 100644
--- a/lib/libc/amd64/gen/_setjmp.S
+++ b/lib/libc/amd64/gen/_setjmp.S
@@ -62,7 +62,7 @@ ENTRY(_setjmp)
movl %ebp,12(%eax)
movl %esi,16(%eax)
movl %edi,20(%eax)
- fnstcw 28(%eax)
+ fnstcw 24(%eax)
xorl %eax,%eax
ret
@@ -76,7 +76,7 @@ ENTRY(_longjmp)
movl 16(%edx),%esi
movl 20(%edx),%edi
fninit
- fldcw 28(%edx)
+ fldcw 24(%edx)
testl %eax,%eax
jnz 1f
incl %eax
diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S
index 0dfdde917b6d..e70879ade8d0 100644
--- a/lib/libc/amd64/gen/setjmp.S
+++ b/lib/libc/amd64/gen/setjmp.S
@@ -56,15 +56,19 @@
ENTRY(setjmp)
PIC_PROLOGUE
- pushl $0
+ movl 4(%esp),%ecx
+ leal 28(%ecx), %eax
+ pushl %eax /* (sigset_t*)oset */
+ pushl $0 /* (sigset_t*)set */
+ pushl $1 /* SIG_BLOCK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigblock))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigblock))
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- popl %edx
+ addl $12,%esp
PIC_EPILOGUE
- movl 4(%esp),%ecx
+ movl 4(%esp),%ecx
movl 0(%esp),%edx
movl %edx, 0(%ecx)
movl %ebx, 4(%ecx)
@@ -72,21 +76,23 @@ ENTRY(setjmp)
movl %ebp,12(%ecx)
movl %esi,16(%ecx)
movl %edi,20(%ecx)
- movl %eax,24(%ecx)
- fnstcw 28(%ecx)
+ fnstcw 24(%ecx)
xorl %eax,%eax
ret
ENTRY(longjmp)
movl 4(%esp),%edx
PIC_PROLOGUE
- pushl 24(%edx)
+ pushl $0 /* (sigset_t*)oset */
+ leal 28(%edx), %eax
+ pushl %eax /* (sigset_t*)set */
+ pushl $3 /* SIG_SETMASK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigsetmask))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigsetmask)) /* XXX this is not reentrant */
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- popl %eax
+ addl $12,%esp
PIC_EPILOGUE
movl 4(%esp),%edx
movl 8(%esp),%eax
@@ -97,7 +103,7 @@ ENTRY(longjmp)
movl 16(%edx),%esi
movl 20(%edx),%edi
fninit
- fldcw 28(%edx)
+ fldcw 24(%edx)
testl %eax,%eax
jnz 1f
incl %eax
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
index c3f98ff0f192..9aa32f4c7d68 100644
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ b/lib/libc/amd64/gen/sigsetjmp.S
@@ -61,21 +61,23 @@
ENTRY(sigsetjmp)
movl 8(%esp),%eax
- movl 4(%esp),%ecx
- movl %eax,32(%ecx)
+ movl 4(%esp),%ecx
+ movl %eax,44(%ecx)
testl %eax,%eax
jz 2f
PIC_PROLOGUE
- pushl $0
+ leal 28(%ecx), %eax
+ pushl %eax /* (sigset_t*)oset */
+ pushl $0 /* (sigset_t*)set */
+ pushl $1 /* SIG_BLOCK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigblock))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigblock))
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- addl $4,%esp
+ addl $12,%esp
PIC_EPILOGUE
- movl 4(%esp),%ecx
- movl %eax,24(%ecx)
+ movl 4(%esp),%ecx
2: movl 0(%esp),%edx
movl %edx, 0(%ecx)
movl %ebx, 4(%ecx)
@@ -83,25 +85,28 @@ ENTRY(sigsetjmp)
movl %ebp,12(%ecx)
movl %esi,16(%ecx)
movl %edi,20(%ecx)
- fnstcw 28(%ecx)
+ fnstcw 24(%ecx)
xorl %eax,%eax
ret
ENTRY(siglongjmp)
movl 4(%esp),%edx
- cmpl $0,32(%edx)
+ cmpl $0,44(%edx)
jz 2f
PIC_PROLOGUE
- pushl 24(%edx)
+ pushl $0 /* (sigset_t*)oset */
+ leal 28(%edx), %eax
+ pushl %eax /* (sigset_t*)set */
+ pushl $3 /* SIG_SETMASK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigsetmask))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigsetmask))
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- addl $4,%esp
+ addl $12,%esp
PIC_EPILOGUE
-2: movl 4(%esp),%edx
- movl 8(%esp),%eax
+ movl 4(%esp),%edx
+2: movl 8(%esp),%eax
movl 0(%edx),%ecx
movl 4(%edx),%ebx
movl 8(%edx),%esp
@@ -109,7 +114,7 @@ ENTRY(siglongjmp)
movl 16(%edx),%esi
movl 20(%edx),%edi
fninit
- fldcw 28(%edx)
+ fldcw 24(%edx)
testl %eax,%eax
jnz 1f
incl %eax
diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc
index 30081e82ffc6..734e15a30a08 100644
--- a/lib/libc/amd64/sys/Makefile.inc
+++ b/lib/libc/amd64/sys/Makefile.inc
@@ -5,15 +5,16 @@ SRCS+= i386_get_ioperm.c i386_get_ldt.c i386_set_ioperm.c i386_set_ldt.c \
i386_vm86.c
MDASM= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S \
- ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigpending.S \
- sigprocmask.S sigreturn.S sigsuspend.S syscall.S
+ ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigreturn.S syscall.S
+# sigpending.S sigprocmask.S sigsuspend.S
# Don't generate default code for these syscalls:
NOASM= __semctl.o break.o exit.o ftruncate.o getdomainname.o getlogin.o \
lseek.o mlockall.o mmap.o msgctl.o msgget.o msgrcv.o msgsnd.o \
munlockall.o openbsd_poll.o pread.o pwrite.o semconfig.o semget.o \
semop.o setdomainname.o shmat.o shmctl.o shmdt.o shmget.o sstk.o \
- thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o
+ thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o \
+ osigpending.o osigprocmask.o osigsuspend.o
PSEUDO= _getlogin.o
diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c
index 56550d223bf7..fa25e50eb334 100644
--- a/lib/libc/compat-43/sigcompat.c
+++ b/lib/libc/compat-43/sigcompat.c
@@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -47,7 +49,8 @@ sigvec(signo, sv, osv)
if (sv)
sv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */
- ret = sigaction(signo, (struct sigaction *)sv, (struct sigaction *)osv);
+ ret = osigaction(signo, (struct osigaction *)sv,
+ (struct osigaction *)osv);
if (ret == 0 && osv)
osv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */
return (ret);
@@ -57,29 +60,34 @@ int
sigsetmask(mask)
int mask;
{
- int omask, n;
+ sigset_t set, oset;
- n = sigprocmask(SIG_SETMASK, (sigset_t *) &mask, (sigset_t *) &omask);
- if (n)
- return (n);
- return (omask);
+ sigemptyset(&set);
+ set.__bits[0] = mask;
+ (void)sigprocmask(SIG_SETMASK, &set, &oset);
+ return (oset.__bits[0]);
}
int
sigblock(mask)
int mask;
{
- int omask, n;
+ sigset_t set, oset;
+
+ sigemptyset(&set);
+ set.__bits[0] = mask;
- n = sigprocmask(SIG_BLOCK, (sigset_t *) &mask, (sigset_t *) &omask);
- if (n)
- return (n);
- return (omask);
+ (void)sigprocmask(SIG_BLOCK, &set, &oset);
+ return (oset.__bits[0]);
}
int
sigpause(mask)
int mask;
{
- return (sigsuspend((sigset_t *)&mask));
+ sigset_t set;
+
+ sigemptyset(&set);
+ set.__bits[0] = mask;
+ return (sigsuspend(&set));
}
diff --git a/lib/libc/gen/sigsetops.c b/lib/libc/gen/sigsetops.c
index 7ac903b52047..7206b7a607b3 100644
--- a/lib/libc/gen/sigsetops.c
+++ b/lib/libc/gen/sigsetops.c
@@ -31,6 +31,8 @@
* SUCH DAMAGE.
*
* @(#)sigsetops.c 8.1 (Berkeley) 6/4/93
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -49,7 +51,10 @@ int
sigemptyset(set)
sigset_t *set;
{
- *set = 0;
+ int i;
+
+ for (i = 0; i < _SIG_WORDS; i++)
+ set->__bits[i] = 0;
return (0);
}
@@ -57,7 +62,10 @@ int
sigfillset(set)
sigset_t *set;
{
- *set = ~(sigset_t)0;
+ int i;
+
+ for (i = 0; i < _SIG_WORDS; i++)
+ set->__bits[i] = ~(unsigned int)0;
return (0);
}
@@ -66,7 +74,12 @@ sigaddset(set, signo)
sigset_t *set;
int signo;
{
- *set |= sigmask(signo);
+
+ if (signo <= 0 || signo > _SIG_MAXSIG) {
+ /* errno = EINVAL; */
+ return (-1);
+ }
+ set->__bits[_SIG_WORD(signo)] |= _SIG_BIT(signo);
return (0);
}
@@ -75,7 +88,12 @@ sigdelset(set, signo)
sigset_t *set;
int signo;
{
- *set &= ~sigmask(signo);
+
+ if (signo <= 0 || signo > _SIG_MAXSIG) {
+ /* errno = EINVAL; */
+ return (-1);
+ }
+ set->__bits[_SIG_WORD(signo)] &= ~_SIG_BIT(signo);
return (0);
}
@@ -84,5 +102,10 @@ sigismember(set, signo)
const sigset_t *set;
int signo;
{
- return ((*set & sigmask(signo)) != 0);
+
+ if (signo <= 0 || signo > _SIG_MAXSIG) {
+ /* errno = EINVAL; */
+ return (-1);
+ }
+ return ((set->__bits[_SIG_WORD(signo)] & _SIG_BIT(signo)) ? 1 : 0);
}
diff --git a/lib/libc/i386/gen/_setjmp.S b/lib/libc/i386/gen/_setjmp.S
index 39ad5accf47e..c8a1d215acda 100644
--- a/lib/libc/i386/gen/_setjmp.S
+++ b/lib/libc/i386/gen/_setjmp.S
@@ -62,7 +62,7 @@ ENTRY(_setjmp)
movl %ebp,12(%eax)
movl %esi,16(%eax)
movl %edi,20(%eax)
- fnstcw 28(%eax)
+ fnstcw 24(%eax)
xorl %eax,%eax
ret
@@ -76,7 +76,7 @@ ENTRY(_longjmp)
movl 16(%edx),%esi
movl 20(%edx),%edi
fninit
- fldcw 28(%edx)
+ fldcw 24(%edx)
testl %eax,%eax
jnz 1f
incl %eax
diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S
index 0dfdde917b6d..e70879ade8d0 100644
--- a/lib/libc/i386/gen/setjmp.S
+++ b/lib/libc/i386/gen/setjmp.S
@@ -56,15 +56,19 @@
ENTRY(setjmp)
PIC_PROLOGUE
- pushl $0
+ movl 4(%esp),%ecx
+ leal 28(%ecx), %eax
+ pushl %eax /* (sigset_t*)oset */
+ pushl $0 /* (sigset_t*)set */
+ pushl $1 /* SIG_BLOCK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigblock))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigblock))
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- popl %edx
+ addl $12,%esp
PIC_EPILOGUE
- movl 4(%esp),%ecx
+ movl 4(%esp),%ecx
movl 0(%esp),%edx
movl %edx, 0(%ecx)
movl %ebx, 4(%ecx)
@@ -72,21 +76,23 @@ ENTRY(setjmp)
movl %ebp,12(%ecx)
movl %esi,16(%ecx)
movl %edi,20(%ecx)
- movl %eax,24(%ecx)
- fnstcw 28(%ecx)
+ fnstcw 24(%ecx)
xorl %eax,%eax
ret
ENTRY(longjmp)
movl 4(%esp),%edx
PIC_PROLOGUE
- pushl 24(%edx)
+ pushl $0 /* (sigset_t*)oset */
+ leal 28(%edx), %eax
+ pushl %eax /* (sigset_t*)set */
+ pushl $3 /* SIG_SETMASK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigsetmask))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigsetmask)) /* XXX this is not reentrant */
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- popl %eax
+ addl $12,%esp
PIC_EPILOGUE
movl 4(%esp),%edx
movl 8(%esp),%eax
@@ -97,7 +103,7 @@ ENTRY(longjmp)
movl 16(%edx),%esi
movl 20(%edx),%edi
fninit
- fldcw 28(%edx)
+ fldcw 24(%edx)
testl %eax,%eax
jnz 1f
incl %eax
diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S
index c3f98ff0f192..9aa32f4c7d68 100644
--- a/lib/libc/i386/gen/sigsetjmp.S
+++ b/lib/libc/i386/gen/sigsetjmp.S
@@ -61,21 +61,23 @@
ENTRY(sigsetjmp)
movl 8(%esp),%eax
- movl 4(%esp),%ecx
- movl %eax,32(%ecx)
+ movl 4(%esp),%ecx
+ movl %eax,44(%ecx)
testl %eax,%eax
jz 2f
PIC_PROLOGUE
- pushl $0
+ leal 28(%ecx), %eax
+ pushl %eax /* (sigset_t*)oset */
+ pushl $0 /* (sigset_t*)set */
+ pushl $1 /* SIG_BLOCK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigblock))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigblock))
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- addl $4,%esp
+ addl $12,%esp
PIC_EPILOGUE
- movl 4(%esp),%ecx
- movl %eax,24(%ecx)
+ movl 4(%esp),%ecx
2: movl 0(%esp),%edx
movl %edx, 0(%ecx)
movl %ebx, 4(%ecx)
@@ -83,25 +85,28 @@ ENTRY(sigsetjmp)
movl %ebp,12(%ecx)
movl %esi,16(%ecx)
movl %edi,20(%ecx)
- fnstcw 28(%ecx)
+ fnstcw 24(%ecx)
xorl %eax,%eax
ret
ENTRY(siglongjmp)
movl 4(%esp),%edx
- cmpl $0,32(%edx)
+ cmpl $0,44(%edx)
jz 2f
PIC_PROLOGUE
- pushl 24(%edx)
+ pushl $0 /* (sigset_t*)oset */
+ leal 28(%edx), %eax
+ pushl %eax /* (sigset_t*)set */
+ pushl $3 /* SIG_SETMASK */
#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigsetmask))
+ call PIC_PLT(CNAME(_thread_sys_sigprocmask))
#else
- call PIC_PLT(CNAME(sigsetmask))
+ call PIC_PLT(CNAME(sigprocmask))
#endif
- addl $4,%esp
+ addl $12,%esp
PIC_EPILOGUE
-2: movl 4(%esp),%edx
- movl 8(%esp),%eax
+ movl 4(%esp),%edx
+2: movl 8(%esp),%eax
movl 0(%edx),%ecx
movl 4(%edx),%ebx
movl 8(%edx),%esp
@@ -109,7 +114,7 @@ ENTRY(siglongjmp)
movl 16(%edx),%esi
movl 20(%edx),%edi
fninit
- fldcw 28(%edx)
+ fldcw 24(%edx)
testl %eax,%eax
jnz 1f
incl %eax
diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc
index 30081e82ffc6..734e15a30a08 100644
--- a/lib/libc/i386/sys/Makefile.inc
+++ b/lib/libc/i386/sys/Makefile.inc
@@ -5,15 +5,16 @@ SRCS+= i386_get_ioperm.c i386_get_ldt.c i386_set_ioperm.c i386_set_ldt.c \
i386_vm86.c
MDASM= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S \
- ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigpending.S \
- sigprocmask.S sigreturn.S sigsuspend.S syscall.S
+ ptrace.S reboot.S rfork.S sbrk.S setlogin.S sigreturn.S syscall.S
+# sigpending.S sigprocmask.S sigsuspend.S
# Don't generate default code for these syscalls:
NOASM= __semctl.o break.o exit.o ftruncate.o getdomainname.o getlogin.o \
lseek.o mlockall.o mmap.o msgctl.o msgget.o msgrcv.o msgsnd.o \
munlockall.o openbsd_poll.o pread.o pwrite.o semconfig.o semget.o \
semop.o setdomainname.o shmat.o shmctl.o shmdt.o shmget.o sstk.o \
- thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o
+ thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o \
+ osigpending.o osigprocmask.o osigsuspend.o
PSEUDO= _getlogin.o
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h
index c6c1100522c0..a58c02f64dfe 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 93d4a6869e5d..155416e2ec3a 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 ed4a58db4647..06b556e69b18 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 3331a5df0bc7..a4717fa23ddb 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 b6aad9ce7e67..3f31a34ab003 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 514f8fa750e5..b880d9c748c8 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 945592202fb4..592a61e865eb 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 7257b7e794cc..96a1e159570b 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))
diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile
index 8e66446b6430..5626a88177ec 100644
--- a/lib/libedit/Makefile
+++ b/lib/libedit/Makefile
@@ -1,6 +1,11 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
+#
+# $FreeBSD$
+#
LIB= edit
+SHLIB_MAJOR= 3
+SHLIB_MINOR= 0
OSRCS= chared.c common.c el.c emacs.c fcns.c help.c hist.c key.c map.c \
parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c
diff --git a/lib/libftpio/Makefile b/lib/libftpio/Makefile
index ce86c166be66..258723e3b612 100644
--- a/lib/libftpio/Makefile
+++ b/lib/libftpio/Makefile
@@ -1,10 +1,14 @@
+#
+# $FreeBSD$
+#
+
LIB= ftpio
CFLAGS+= -I${.CURDIR} -Wall
SRCS= ftpio.c ftperr.c
MAN3= ftpio.3
CLEANFILES+= ftperr.c
-SHLIB_MAJOR= 4
+SHLIB_MAJOR= 5
SHLIB_MINOR= 0
beforeinstall:
diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c
index 93d4a6869e5d..155416e2ec3a 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 ed4a58db4647..06b556e69b18 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 3331a5df0bc7..a4717fa23ddb 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 c6c1100522c0..a58c02f64dfe 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 b6aad9ce7e67..3f31a34ab003 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 514f8fa750e5..b880d9c748c8 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 945592202fb4..592a61e865eb 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 7257b7e794cc..96a1e159570b 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))
diff --git a/lib/libpthread/thread/thr_fork.c b/lib/libpthread/thread/thr_fork.c
index 93d4a6869e5d..155416e2ec3a 100644
--- a/lib/libpthread/thread/thr_fork.c
+++ b/lib/libpthread/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/libpthread/thread/thr_info.c b/lib/libpthread/thread/thr_info.c
index ed4a58db4647..06b556e69b18 100644
--- a/lib/libpthread/thread/thr_info.c
+++ b/lib/libpthread/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/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index 3331a5df0bc7..a4717fa23ddb 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/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/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h
index c6c1100522c0..a58c02f64dfe 100644
--- a/lib/libpthread/thread/thr_private.h
+++ b/lib/libpthread/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/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c
index b6aad9ce7e67..3f31a34ab003 100644
--- a/lib/libpthread/thread/thr_sig.c
+++ b/lib/libpthread/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/libpthread/thread/thr_sigmask.c b/lib/libpthread/thread/thr_sigmask.c
index 514f8fa750e5..b880d9c748c8 100644
--- a/lib/libpthread/thread/thr_sigmask.c
+++ b/lib/libpthread/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/libpthread/thread/thr_sigprocmask.c b/lib/libpthread/thread/thr_sigprocmask.c
index 945592202fb4..592a61e865eb 100644
--- a/lib/libpthread/thread/thr_sigprocmask.c
+++ b/lib/libpthread/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/libpthread/thread/thr_sigwait.c b/lib/libpthread/thread/thr_sigwait.c
index 7257b7e794cc..96a1e159570b 100644
--- a/lib/libpthread/thread/thr_sigwait.c
+++ b/lib/libpthread/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))
diff --git a/lib/libss/Makefile b/lib/libss/Makefile
index 9638585124e1..8cd34b116811 100644
--- a/lib/libss/Makefile
+++ b/lib/libss/Makefile
@@ -1,6 +1,9 @@
# $FreeBSD$
LIB= ss
+SHLIB_MAJOR= 3
+SHLIB_MINOR= 0
+
SRCS= data.c error.c execute_cmd.c help.c invocation.c list_rqs.c \
listen.c pager.c parse.c prompt.c request_tbl.c requests.c \
ss_err.c ss_err.h std_rqs.c
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 4b49635a60cf..42e4bda33278 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -209,7 +209,6 @@ SUBDIR+=telnet
# Things that don't compile on alpha or are aout specific:
SUBDIR+=ar \
brandelf \
- doscmd \
gcore \
gprof4 \
nm \
@@ -218,6 +217,7 @@ SUBDIR+=ar \
size \
strings \
strip
+# doscmd \
.endif
.include <bsd.subdir.mk>
diff --git a/usr.sbin/pcvt/vttest/Makefile b/usr.sbin/pcvt/vttest/Makefile
index 3c6f0896c2af..a8f05389a610 100644
--- a/usr.sbin/pcvt/vttest/Makefile
+++ b/usr.sbin/pcvt/vttest/Makefile
@@ -1,6 +1,9 @@
+#
+# $FreeBSD$
+#
PROG= vttest
-CFLAGS+= -traditional -DUSEMYSTTY
+CFLAGS+= -DUSEMYSTTY
SRCS= main.c esc.c
.include <bsd.prog.mk>
diff --git a/usr.sbin/rpc.statd/statd.c b/usr.sbin/rpc.statd/statd.c
index 3b47dfe041bb..7de4c1413100 100644
--- a/usr.sbin/rpc.statd/statd.c
+++ b/usr.sbin/rpc.statd/statd.c
@@ -125,7 +125,7 @@ usage()
children to exit when they have done their work.
*/
-static void handle_sigchld(int sig, int code, struct sigcontext *scp)
+static void handle_sigchld(int sig, int code, void *scp)
{
int pid, status;
pid = wait4(-1, &status, WNOHANG, (struct rusage*)0);