summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-10-23 04:39:26 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-10-23 04:39:26 +0000
commita982c64703a6852d4518f8dee8a656db84842b70 (patch)
tree84d8a777e0e15a51aad4ff1546f6b8e588d3d434 /lib
parent67c7a47ecfaff0ecbfc81e62dfc8975d04c414ac (diff)
Merge the sigaction() and sigprocmask() overloads/wrappers from libpthread
into libc, and move pthread_sigmask() as well (just a trivial wrapper). This provides consistent handling of SIGTHR between single- and multi-threaded programs and is a step in the merge of all the libpthread overloads, providing some ASM and Makefile bits that the other wrappers will need. ok deraadt@ millert@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/Symbols.list1
-rw-r--r--lib/libc/arch/alpha/SYS.h8
-rw-r--r--lib/libc/arch/alpha/sys/sigpending.S4
-rw-r--r--lib/libc/arch/alpha/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/alpha/sys/sigsuspend.S4
-rw-r--r--lib/libc/arch/amd64/SYS.h4
-rw-r--r--lib/libc/arch/amd64/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/arm/SYS.h4
-rw-r--r--lib/libc/arch/arm/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/hppa/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/hppa64/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/i386/SYS.h4
-rw-r--r--lib/libc/arch/i386/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/m88k/SYS.h8
-rw-r--r--lib/libc/arch/m88k/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/mips64/SYS.h12
-rw-r--r--lib/libc/arch/mips64/sys/sigpending.S6
-rw-r--r--lib/libc/arch/mips64/sys/sigprocmask.S8
-rw-r--r--lib/libc/arch/mips64/sys/sigsuspend.S6
-rw-r--r--lib/libc/arch/powerpc/SYS.h8
-rw-r--r--lib/libc/arch/powerpc/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/sh/SYS.h3
-rw-r--r--lib/libc/arch/sh/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/sparc/SYS.h4
-rw-r--r--lib/libc/arch/sparc/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/sparc64/SYS.h8
-rw-r--r--lib/libc/arch/sparc64/sys/sigprocmask.S6
-rw-r--r--lib/libc/arch/vax/SYS.h8
-rw-r--r--lib/libc/arch/vax/sys/sigprocmask.S6
-rw-r--r--lib/libc/compat-43/sigcompat.c8
-rw-r--r--lib/libc/gen/posix_spawn.c7
-rw-r--r--lib/libc/gen/siginterrupt.c6
-rw-r--r--lib/libc/gen/signal.c4
-rw-r--r--lib/libc/hidden/signal.h10
-rw-r--r--lib/libc/include/namespace.h11
-rw-r--r--lib/libc/stdlib/abort.c7
-rw-r--r--lib/libc/sys/Makefile.inc24
-rw-r--r--lib/libc/sys/pthread_sigmask.c26
-rw-r--r--lib/libc/sys/w_sigaction.c41
-rw-r--r--lib/libc/sys/w_sigprocmask.c37
-rw-r--r--lib/librthread/rthread.c6
-rw-r--r--lib/librthread/rthread_sig.c38
-rw-r--r--lib/librthread/shlib_version2
43 files changed, 250 insertions, 149 deletions
diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list
index 3c32bac4966..09da8af364b 100644
--- a/lib/libc/Symbols.list
+++ b/lib/libc/Symbols.list
@@ -364,6 +364,7 @@ pread
preadv
profil
pselect
+pthread_sigmask
ptrace
pwrite
pwritev
diff --git a/lib/libc/arch/alpha/SYS.h b/lib/libc/arch/alpha/SYS.h
index 41b3cee56d3..c1bb2bef372 100644
--- a/lib/libc/arch/alpha/SYS.h
+++ b/lib/libc/arch/alpha/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.12 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.13 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: SYS.h,v 1.4 1996/10/17 03:03:53 cgd Exp $ */
/*
@@ -132,7 +132,9 @@ __END(p,label);
# define PSEUDO_NOERROR(x,y) ALIAS(_thread_sys_,x) \
__PSEUDO_NOERROR(_thread_sys_,x,y); \
_END(x)
+# define SYSLEAF_HIDDEN(x,e) __LEAF(_thread_sys_,x,e)
# define SYSLEAF(x,e) ALIAS(_thread_sys_,x) \
- __LEAF(_thread_sys_,x,e)
-# define SYSEND(x) __END(_thread_sys_,x); \
+ SYSLEAF_HIDDEN(x,e)
+# define SYSCALL_END_HIDDEN(x) __END(_thread_sys_,x)
+# define SYSCALL_END(x) SYSCALL_END_HIDDEN(x); \
_END(x)
diff --git a/lib/libc/arch/alpha/sys/sigpending.S b/lib/libc/arch/alpha/sys/sigpending.S
index 1accad82973..e1d73dff9c7 100644
--- a/lib/libc/arch/alpha/sys/sigpending.S
+++ b/lib/libc/arch/alpha/sys/sigpending.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigpending.S,v 1.5 2005/08/07 16:40:13 espie Exp $ */
+/* $OpenBSD: sigpending.S,v 1.6 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: sigpending.S,v 1.1 1995/02/10 17:50:40 cgd Exp $ */
/*
@@ -34,4 +34,4 @@ SYSCALL(sigpending)
stl v0, 0(a0)
mov zero, v0
RET
-SYSEND(sigpending)
+SYSCALL_END(sigpending)
diff --git a/lib/libc/arch/alpha/sys/sigprocmask.S b/lib/libc/arch/alpha/sys/sigprocmask.S
index 2f7d7bda2c7..d7f3659b19d 100644
--- a/lib/libc/arch/alpha/sys/sigprocmask.S
+++ b/lib/libc/arch/alpha/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.5 2005/08/07 16:40:13 espie Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.6 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: sigprocmask.S,v 1.2 1996/10/17 03:08:21 cgd Exp $ */
/*
@@ -30,7 +30,7 @@
#include "SYS.h"
-SYSLEAF(sigprocmask, 3)
+SYSLEAF_HIDDEN(sigprocmask, 3)
mov a2, a5 /* safe */
cmoveq a1, 1, a0 /* if set == NULL, how = SIG_BLOCK */
beq a1, Ldoit /* and set = 0, and do it. */
@@ -41,4 +41,4 @@ Ldoit: CALLSYS_ERROR(sigprocmask)
Lret: mov zero, v0
RET
-SYSEND(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/alpha/sys/sigsuspend.S b/lib/libc/arch/alpha/sys/sigsuspend.S
index 61a81f51e39..f5201db29f6 100644
--- a/lib/libc/arch/alpha/sys/sigsuspend.S
+++ b/lib/libc/arch/alpha/sys/sigsuspend.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigsuspend.S,v 1.6 2005/08/07 16:40:13 espie Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.7 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: sigsuspend.S,v 1.2 1996/10/17 03:08:22 cgd Exp $ */
/*
@@ -35,4 +35,4 @@ SYSLEAF(sigsuspend, 1)
CALLSYS_ERROR(sigsuspend)
mov zero, v0 /* shouldn't need; just in case... */
RET
-SYSEND(sigsuspend)
+SYSCALL_END(sigsuspend)
diff --git a/lib/libc/arch/amd64/SYS.h b/lib/libc/arch/amd64/SYS.h
index 9c13df11199..e9b6be457eb 100644
--- a/lib/libc/arch/amd64/SYS.h
+++ b/lib/libc/arch/amd64/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.16 2015/10/17 22:40:54 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.17 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -114,6 +114,8 @@
#define SYSCALL_NOERROR(x) \
_SYSCALL_NOERROR(x,x)
+#define SYSCALL_HIDDEN(x) \
+ _SYSCALL_HIDDEN(x,x)
#define SYSCALL(x) \
_SYSCALL(x,x)
diff --git a/lib/libc/arch/amd64/sys/sigprocmask.S b/lib/libc/arch/amd64/sys/sigprocmask.S
index c3c3acc3fd0..065088d6548 100644
--- a/lib/libc/arch/amd64/sys/sigprocmask.S
+++ b/lib/libc/arch/amd64/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.7 2015/10/17 22:40:54 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.8 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: sigprocmask.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */
/*-
@@ -39,7 +39,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
testq %rsi,%rsi # check new sigset pointer
jnz 1f # if not null, indirect
movl $1,%edi # SIG_BLOCK
@@ -60,4 +60,4 @@ out:
#else
jmp CERROR
#endif
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/arm/SYS.h b/lib/libc/arch/arm/SYS.h
index 94824881eb2..9812bb3ebc6 100644
--- a/lib/libc/arch/arm/SYS.h
+++ b/lib/libc/arch/arm/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.13 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.14 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */
/*-
@@ -127,5 +127,7 @@
PSEUDO_HIDDEN(x,x)
#define SYSCALL_END(x) \
__END(x)
+#define SYSCALL_END_HIDDEN(x) \
+ __END_HIDDEN(x)
.globl CERROR
diff --git a/lib/libc/arch/arm/sys/sigprocmask.S b/lib/libc/arch/arm/sys/sigprocmask.S
index aab0d86434c..b0ca0387990 100644
--- a/lib/libc/arch/arm/sys/sigprocmask.S
+++ b/lib/libc/arch/arm/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.3 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.4 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: sigprocmask.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */
/*-
@@ -34,7 +34,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
teq r1, #0x00000000
moveq r0, #0x00000001
moveq r1, #0x00000000
@@ -45,4 +45,4 @@ SYSENTRY(sigprocmask)
strne r0, [r2]
mov r0, #0x00000000
mov r15, r14
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/hppa/sys/sigprocmask.S b/lib/libc/arch/hppa/sys/sigprocmask.S
index e463e827bb0..f173e24340c 100644
--- a/lib/libc/arch/hppa/sys/sigprocmask.S
+++ b/lib/libc/arch/hppa/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.13 2006/01/05 22:13:55 kettenis Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.14 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -28,7 +28,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
/* just in case compiler forgot about this */
stw arg2, HPPA_FRAME_ARG(2)(sp)
@@ -49,6 +49,6 @@ sigprocmask$call
stw ret0, 0(arg2)
bv r0(rp)
copy r0, ret0
-SYSEXIT(sigprocmask)
+SYSEXIT_HIDDEN(sigprocmask)
.end
diff --git a/lib/libc/arch/hppa64/sys/sigprocmask.S b/lib/libc/arch/hppa64/sys/sigprocmask.S
index e68ff9d0629..eff082a7810 100644
--- a/lib/libc/arch/hppa64/sys/sigprocmask.S
+++ b/lib/libc/arch/hppa64/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.5 2011/08/16 18:58:45 kettenis Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.6 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -28,7 +28,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
std %arg2, HPPA_FRAME_ARG(2)(%sp)
comb,<>,n %r0, %arg1, sigprocmask$nblock
@@ -47,6 +47,6 @@ sigprocmask$call
stw %ret0, 0(%arg2)
bv %r0(%rp)
copy %r0, %ret0
-SYSEXIT(sigprocmask)
+SYSEXIT_HIDDEN(sigprocmask)
.end
diff --git a/lib/libc/arch/i386/SYS.h b/lib/libc/arch/i386/SYS.h
index 2cb60bc11ac..7373a9796a9 100644
--- a/lib/libc/arch/i386/SYS.h
+++ b/lib/libc/arch/i386/SYS.h
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.23 2015/09/05 06:22:47 guenther Exp $
+ * $OpenBSD: SYS.h,v 1.24 2015/10/23 04:39:24 guenther Exp $
*/
#include <machine/asm.h>
@@ -160,5 +160,7 @@
#define RSYSCALL_HIDDEN(x) \
PSEUDO_HIDDEN(x,x)
#define SYSCALL_END(x) __END(x)
+#define SYSCALL_END_HIDDEN(x) \
+ __END_HIDDEN(x)
.globl CERROR
diff --git a/lib/libc/arch/i386/sys/sigprocmask.S b/lib/libc/arch/i386/sys/sigprocmask.S
index 1c47261a171..2f7b31e2de9 100644
--- a/lib/libc/arch/i386/sys/sigprocmask.S
+++ b/lib/libc/arch/i386/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.10 2015/09/05 06:22:47 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.11 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -33,7 +33,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
movl 8(%esp),%ecx # fetch new sigset pointer
testl %ecx,%ecx # check new sigset pointer
jnz 1f # if not null, indirect
@@ -62,4 +62,4 @@ out:
#else
jmp CERROR
#endif
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/m88k/SYS.h b/lib/libc/arch/m88k/SYS.h
index 5cf59fa3021..7e6f399ff87 100644
--- a/lib/libc/arch/m88k/SYS.h
+++ b/lib/libc/arch/m88k/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.21 2015/09/10 13:29:09 guenther Exp $*/
+/* $OpenBSD: SYS.h,v 1.22 2015/10/23 04:39:24 guenther Exp $*/
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -143,9 +143,11 @@
#define RSYSCALL_HIDDEN(x) __PSEUDO_HIDDEN(_thread_sys_,x,x)
#define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y)
#define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y)
-#define SYSENTRY(x) __ENTRY(_thread_sys_,x); \
+#define SYSENTRY_HIDDEN(x) __ENTRY(_thread_sys_,x)
+#define SYSENTRY(x) SYSENTRY_HIDDEN(x); \
__ALIAS(_thread_sys_,x)
-#define SYSCALL_END(x) __END(_thread_sys_,x); END(x)
+#define SYSCALL_END_HIDDEN(x) __END(_thread_sys_,x)
+#define SYSCALL_END(x) SYSCALL_END_HIDDEN(x); END(x)
#define ASMSTR .asciz
diff --git a/lib/libc/arch/m88k/sys/sigprocmask.S b/lib/libc/arch/m88k/sys/sigprocmask.S
index b7a8e32ba3f..5ce01f22762 100644
--- a/lib/libc/arch/m88k/sys/sigprocmask.S
+++ b/lib/libc/arch/m88k/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.11 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.12 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
bcnd ne0,%r3,1f /* if new sigset pointer is null */
or %r2,%r0,1 /* how = SIG_BLOCK and do it */
br 2f
@@ -50,4 +50,4 @@ SYSENTRY(sigprocmask)
3:
jmp.n %r1
or %r2,%r0,0
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/mips64/SYS.h b/lib/libc/arch/mips64/SYS.h
index 49b2269c97c..bc4bcfa9f45 100644
--- a/lib/libc/arch/mips64/SYS.h
+++ b/lib/libc/arch/mips64/SYS.h
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.10 2015/09/05 17:32:18 miod Exp $
+ * $OpenBSD: SYS.h,v 1.11 2015/10/23 04:39:24 guenther Exp $
*/
#include <sys/syscall.h>
@@ -78,8 +78,6 @@
# define __END2(p,x) __END2_HIDDEN(p,x); \
.size x, . - x
-# define __CLABEL2(p,x) _C_LABEL(p ## x)
-
#define __PSEUDO_NOERROR(p,x,y) \
__LEAF2(p,x, 0); \
__DO_SYSCALL(y); \
@@ -89,7 +87,7 @@
#define __PSEUDO(p,x,y) \
__LEAF2(p,x,32); \
PTR_SUBU sp,32; \
- SETUP_GP64(16,__CLABEL2(p,x)); \
+ SETUP_GP64(16,_HIDDEN(x)); \
__DO_SYSCALL(y); \
bne a3,zero,1f; \
RESTORE_GP64; \
@@ -103,7 +101,7 @@
#define __PSEUDO_HIDDEN(p,x,y) \
LEAF(p ## x,32); \
PTR_SUBU sp,32; \
- SETUP_GP64(16,__CLABEL2(p,x)); \
+ SETUP_GP64(16,_HIDDEN(x)); \
__DO_SYSCALL(y); \
bne a3,zero,1f; \
RESTORE_GP64; \
@@ -122,5 +120,7 @@
#define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y)
#define SYSLEAF(x, sz) __LEAF2(_thread_sys_,x, sz)
-#define SYSEND(x) __END2(_thread_sys_,x)
+#define SYSLEAF_HIDDEN(x, sz) LEAF(_thread_sys_ ## x, sz)
+#define SYSCALL_END(x) __END2(_thread_sys_,x)
+#define SYSCALL_END_HIDDEN(x) __END2_HIDDEN(_thread_sys_,x)
diff --git a/lib/libc/arch/mips64/sys/sigpending.S b/lib/libc/arch/mips64/sys/sigpending.S
index 7d55fdcb507..f1217070fdd 100644
--- a/lib/libc/arch/mips64/sys/sigpending.S
+++ b/lib/libc/arch/mips64/sys/sigpending.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigpending.S,v 1.6 2015/10/04 06:34:35 guenther Exp $ */
+/* $OpenBSD: sigpending.S,v 1.7 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -38,7 +38,7 @@ GPOFF= FRAMESZ-2*REGSZ
SYSLEAF(sigpending, FRAMESZ)
PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, sigpending)
+ SETUP_GP64(GPOFF, _HIDDEN(sigpending))
.set reorder
li v0, SYS_sigpending
syscall
@@ -53,4 +53,4 @@ SYSLEAF(sigpending, FRAMESZ)
RESTORE_GP64
PTR_ADDU sp, FRAMESZ
jr t9
-SYSEND(sigpending)
+SYSCALL_END(sigpending)
diff --git a/lib/libc/arch/mips64/sys/sigprocmask.S b/lib/libc/arch/mips64/sys/sigprocmask.S
index d307ca62b1f..5b079a8a8ea 100644
--- a/lib/libc/arch/mips64/sys/sigprocmask.S
+++ b/lib/libc/arch/mips64/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.6 2015/09/05 06:22:47 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.7 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -36,9 +36,9 @@
FRAMESZ= MKFSIZ(1,1)
GPOFF= FRAMESZ-2*REGSZ
-SYSLEAF(sigprocmask, FRAMESZ)
+SYSLEAF_HIDDEN(sigprocmask, FRAMESZ)
PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, sigprocmask)
+ SETUP_GP64(GPOFF, _HIDDEN(sigprocmask))
.set reorder
bne a1, zero, .Lgotptr # if new sigset pointer not null
li a0, 1 # how = SIG_BLOCK
@@ -61,4 +61,4 @@ SYSLEAF(sigprocmask, FRAMESZ)
RESTORE_GP64
PTR_ADDU sp, FRAMESZ
jr t9
-SYSEND(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/mips64/sys/sigsuspend.S b/lib/libc/arch/mips64/sys/sigsuspend.S
index d9801b2f2be..8fec33adb6e 100644
--- a/lib/libc/arch/mips64/sys/sigsuspend.S
+++ b/lib/libc/arch/mips64/sys/sigsuspend.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigsuspend.S,v 1.5 2011/04/04 12:42:39 guenther Exp $ */
+/* $OpenBSD: sigsuspend.S,v 1.6 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -38,7 +38,7 @@ GPOFF= FRAMESZ-2*REGSZ
SYSLEAF(sigsuspend, FRAMESZ)
PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, sigsuspend)
+ SETUP_GP64(GPOFF, _HIDDEN(sigsuspend))
.set reorder
lw a0, 0(a0) # indirect to mask arg
li v0, SYS_sigsuspend
@@ -53,4 +53,4 @@ SYSLEAF(sigsuspend, FRAMESZ)
RESTORE_GP64
PTR_ADDU sp, FRAMESZ
jr t9
-SYSEND(sigsuspend)
+SYSCALL_END(sigsuspend)
diff --git a/lib/libc/arch/powerpc/SYS.h b/lib/libc/arch/powerpc/SYS.h
index 837258efaa4..61036697b71 100644
--- a/lib/libc/arch/powerpc/SYS.h
+++ b/lib/libc/arch/powerpc/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.19 2015/09/05 06:22:47 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.20 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1994
* Andrew Cagney. All rights reserved.
@@ -86,10 +86,9 @@
#define ALIAS(x,y) WEAK_ALIAS(y,_CONCAT(x,y));
+#define PREFIX_HIDDEN(x) PSEUDO_PREFIX(_thread_sys_,x,x)
#define PREFIX(x) ALIAS(_thread_sys_,x) \
- PSEUDO_PREFIX(_thread_sys_,x,x)
-#define PREFIX2(x,y) ALIAS(_thread_sys_,x) \
- PSEUDO_PREFIX(_thread_sys_,x,y)
+ PREFIX_HIDDEN(x)
#define PSEUDO_NOERROR(x,y) ALIAS(_thread_sys_,x) \
PSEUDO_PREFIX(_thread_sys_,x,y) ; \
sc ; \
@@ -106,5 +105,6 @@
#define RSYSCALL(x) PSEUDO(x,x)
#define RSYSCALL_HIDDEN(x) PSEUDO_HIDDEN(x,x)
+#define SYSCALL_END_HIDDEN(x) __END_HIDDEN(_thread_sys_,x)
#define SYSCALL_END(x) __END(_thread_sys_,x)
diff --git a/lib/libc/arch/powerpc/sys/sigprocmask.S b/lib/libc/arch/powerpc/sys/sigprocmask.S
index 5ec4fc00d1c..2d43827bb82 100644
--- a/lib/libc/arch/powerpc/sys/sigprocmask.S
+++ b/lib/libc/arch/powerpc/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.9 2015/09/05 06:22:47 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.10 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
@@ -30,7 +30,7 @@
#include "SYS.h"
.text
-PREFIX(sigprocmask)
+PREFIX_HIDDEN(sigprocmask)
stwu 1, -16(1)
stw 5, 12(1)
@@ -60,4 +60,4 @@ PREFIX(sigprocmask)
li 3, 0
addi 1, 1, 16
blr
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/sh/SYS.h b/lib/libc/arch/sh/SYS.h
index ea6ad7b7b01..c3b95350399 100644
--- a/lib/libc/arch/sh/SYS.h
+++ b/lib/libc/arch/sh/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.8 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.9 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -159,5 +159,6 @@
#define RSYSCALL(x) PSEUDO(x,x)
#define RSYSCALL_HIDDEN(x) PSEUDO_HIDDEN(x,x)
#define SYSCALL_END(x) __END(x)
+#define SYSCALL_END_HIDDEN(x) __END_HIDDEN(x)
.globl CERROR
diff --git a/lib/libc/arch/sh/sys/sigprocmask.S b/lib/libc/arch/sh/sys/sigprocmask.S
index 381050fd82d..f4d807a87ee 100644
--- a/lib/libc/arch/sh/sys/sigprocmask.S
+++ b/lib/libc/arch/sh/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.2 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.3 2015/10/23 04:39:24 guenther Exp $ */
/* $NetBSD: sigprocmask.S,v 1.6 2003/08/07 16:42:21 agc Exp $ */
/*-
@@ -37,7 +37,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
mov r5, r2 /* fetch new sigset pointer */
tst r2, r2 /* check new sigset pointer */
bf 1f /* if not null, indirect */
@@ -63,4 +63,4 @@ SYSENTRY(sigprocmask)
.align 2
LSYS_sigprocmask:
.long SYS_sigprocmask
-SYSCALL_END(sigpending)
+SYSCALL_END_HIDDEN(sigpending)
diff --git a/lib/libc/arch/sparc/SYS.h b/lib/libc/arch/sparc/SYS.h
index 68227774a9f..1e22754c186 100644
--- a/lib/libc/arch/sparc/SYS.h
+++ b/lib/libc/arch/sparc/SYS.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: SYS.h,v 1.19 2015/09/10 13:29:09 guenther Exp $
+ * $OpenBSD: SYS.h,v 1.20 2015/10/23 04:39:25 guenther Exp $
*/
#include "DEFS.h"
@@ -109,6 +109,8 @@
# define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y)
# define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y)
# define SYSENTRY(x) __ENTRY(_thread_sys_,x)
+# define SYSENTRY_HIDDEN(x) __ENTRY_HIDDEN(_thread_sys_,x)
# define SYSCALL_END(x) __END(_thread_sys_,x)
+# define SYSCALL_END_HIDDEN(x) __END_HIDDEN(_thread_sys_,x)
.globl _C_LABEL(__cerror)
diff --git a/lib/libc/arch/sparc/sys/sigprocmask.S b/lib/libc/arch/sparc/sys/sigprocmask.S
index 5e0e9233b52..7122af5f842 100644
--- a/lib/libc/arch/sparc/sys/sigprocmask.S
+++ b/lib/libc/arch/sparc/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.6 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.7 2015/10/23 04:39:25 guenther Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -37,7 +37,7 @@
/*
* sigprocmask(int how, sigset_t *set, sigset_t *oset)
*/
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
tst %o1 ! set == NULL?
bne,a 1f ! if not,
ld [%o1], %o1 ! replace it in %o1 with *set
@@ -55,4 +55,4 @@ SYSENTRY(sigprocmask)
3:
retl ! in any case, return 0
clr %o0
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/sparc64/SYS.h b/lib/libc/arch/sparc64/SYS.h
index 30cb179ce19..85c48829f8c 100644
--- a/lib/libc/arch/sparc64/SYS.h
+++ b/lib/libc/arch/sparc64/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.14 2015/09/05 06:22:47 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.15 2015/10/23 04:39:25 guenther Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -160,13 +160,13 @@
/*
* SYSENTRY is for functions that pretend to be syscalls.
*/
-#define __SYSENTRY(p,x) __ENTRY(p,x)
-
#define SYSCALL(x) __SYSCALL(_thread_sys_,x)
#define RSYSCALL(x) __RSYSCALL(_thread_sys_,x)
#define RSYSCALL_HIDDEN(x) __RSYSCALL_HIDDEN(_thread_sys_,x)
#define RSYSCALL_NOERROR(x,y) __RSYSCALL_NOERROR(_thread_sys_,x,y)
#define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y)
#define PSEUDO_NOERROR(x,y) __PSEUDO_NOERROR(_thread_sys_,x,y)
-#define SYSENTRY(x) __SYSENTRY(_thread_sys_,x)
+#define SYSENTRY(x) __ENTRY(_thread_sys_,x)
+#define SYSENTRY_HIDDEN(x) __ENTRY_HIDDEN(_thread_sys_,x)
#define SYSCALL_END(x) __END(_thread_sys_,x)
+#define SYSCALL_END_HIDDEN(x) __END_HIDDEN(_thread_sys_,x)
diff --git a/lib/libc/arch/sparc64/sys/sigprocmask.S b/lib/libc/arch/sparc64/sys/sigprocmask.S
index e59f98fd72d..3d3fa865c0f 100644
--- a/lib/libc/arch/sparc64/sys/sigprocmask.S
+++ b/lib/libc/arch/sparc64/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.3 2015/09/05 06:22:47 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.4 2015/10/23 04:39:25 guenther Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -39,7 +39,7 @@
/*
* sigprocmask(int how, sigset_t *set, sigset_t *oset)
*/
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
brnz,a %o1, 1f /* if (set != NULL) */
ld [%o1], %o1 /* replace it in %o1 with *set */
/* clr %o1 * else block no signals ... */
@@ -56,4 +56,4 @@ SYSENTRY(sigprocmask)
3:
retl /* in any case, return 0 */
clr %o0
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/arch/vax/SYS.h b/lib/libc/arch/vax/SYS.h
index 763345190d6..036ee5a4090 100644
--- a/lib/libc/arch/vax/SYS.h
+++ b/lib/libc/arch/vax/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.19 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: SYS.h,v 1.20 2015/10/23 04:39:25 guenther Exp $ */
/* $NetBSD: SYS.h,v 1.4 1997/05/02 18:15:32 kleink Exp $ */
/*
@@ -68,7 +68,8 @@
*/
#define SYSCALL(x) __ALIAS(_thread_sys_,x) \
__SYSCALL(_thread_sys_,x,x)
-#define SYSCALL_END(x) __END(_thread_sys_,x); END(x)
+#define SYSCALL_END_HIDDEN(x) __END(_thread_sys_,x)
+#define SYSCALL_END(x) SYSCALL_END_HIDDEN(x); END(x)
#define RSYSCALL(x) __ALIAS(_thread_sys_,x) \
__PSEUDO(_thread_sys_,x,x); \
END(x)
@@ -79,8 +80,9 @@
#define PSEUDO_NOERROR(x,y) __ALIAS(_thread_sys_,x) \
__PSEUDO_NOERROR(_thread_sys_,x,y); \
END(x)
+#define SYSENTRY_HIDDEN(x) __ENTRY(_thread_sys_,x)
#define SYSENTRY(x) __ALIAS(_thread_sys_,x) \
- __ENTRY(_thread_sys_,x)
+ SYSENTRY_HIDDEN(x)
#define SYSNAME(x) _CAT(__thread_sys_,x)
.globl _C_LABEL(__cerror)
diff --git a/lib/libc/arch/vax/sys/sigprocmask.S b/lib/libc/arch/vax/sys/sigprocmask.S
index be39d69a021..3771cd02b4e 100644
--- a/lib/libc/arch/vax/sys/sigprocmask.S
+++ b/lib/libc/arch/vax/sys/sigprocmask.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigprocmask.S,v 1.10 2015/09/10 13:29:09 guenther Exp $ */
+/* $OpenBSD: sigprocmask.S,v 1.11 2015/10/23 04:39:25 guenther Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
tstl 8(%ap) # check new sigset pointer
bneq 1f # if not null, indirect
/* movl $0,8(%ap) # null mask pointer: block empty set */
@@ -48,4 +48,4 @@ SYSENTRY(sigprocmask)
ret
4:
jmp _C_LABEL(__cerror)
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c
index 4e82ef5bd35..c4f2407d22b 100644
--- a/lib/libc/compat-43/sigcompat.c
+++ b/lib/libc/compat-43/sigcompat.c
@@ -39,7 +39,7 @@ sigvec(int signo, struct sigvec *sv, struct sigvec *osv)
nsv = *sv;
nsv.sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */
}
- ret = sigaction(signo, sv ? (struct sigaction *)&nsv : NULL,
+ ret = WRAP(sigaction)(signo, sv ? (struct sigaction *)&nsv : NULL,
(struct sigaction *)osv);
if (ret == 0 && osv)
osv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */
@@ -51,7 +51,8 @@ sigsetmask(int mask)
{
int omask, n;
- n = sigprocmask(SIG_SETMASK, (sigset_t *) &mask, (sigset_t *) &omask);
+ n = WRAP(sigprocmask)(SIG_SETMASK, (sigset_t *) &mask,
+ (sigset_t *) &omask);
if (n)
return (n);
return (omask);
@@ -63,7 +64,8 @@ sigblock(int mask)
{
int omask, n;
- n = sigprocmask(SIG_BLOCK, (sigset_t *) &mask, (sigset_t *) &omask);
+ n = WRAP(sigprocmask)(SIG_BLOCK, (sigset_t *) &mask,
+ (sigset_t *) &omask);
if (n)
return (n);
return (omask);
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index dd175e6582f..27e6d741069 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: posix_spawn.c,v 1.7 2015/09/10 18:13:46 guenther Exp $ */
+/* $OpenBSD: posix_spawn.c,v 1.8 2015/10/23 04:39:24 guenther Exp $ */
/*-
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
@@ -119,12 +119,13 @@ process_spawnattr(const posix_spawnattr_t sa)
/* Set signal masks/defaults */
if (sa->sa_flags & POSIX_SPAWN_SETSIGMASK) {
- sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
+ WRAP(sigprocmask)(SIG_SETMASK, &sa->sa_sigmask, NULL);
}
if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) {
for (i = 1; i < _NSIG; i++) {
- if (sigismember(&sa->sa_sigdefault, i))
+ /* silently ignore attempts to alter SIGTHR */
+ if (sigismember(&sa->sa_sigdefault, i) && i != SIGTHR)
if (sigaction(i, &sigact, NULL) != 0)
return (errno);
}
diff --git a/lib/libc/gen/siginterrupt.c b/lib/libc/gen/siginterrupt.c
index ed23687b697..b6725a6d7b6 100644
--- a/lib/libc/gen/siginterrupt.c
+++ b/lib/libc/gen/siginterrupt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siginterrupt.c,v 1.7 2015/09/09 16:10:03 guenther Exp $ */
+/* $OpenBSD: siginterrupt.c,v 1.8 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -40,7 +40,7 @@ siginterrupt(int sig, int flag)
struct sigaction sa;
int ret;
- if ((ret = sigaction(sig, (struct sigaction *)0, &sa)) < 0)
+ if ((ret = WRAP(sigaction)(sig, NULL, &sa)) < 0)
return (ret);
if (flag) {
sigaddset(&__sigintr, sig);
@@ -49,5 +49,5 @@ siginterrupt(int sig, int flag)
sigdelset(&__sigintr, sig);
sa.sa_flags |= SA_RESTART;
}
- return (sigaction(sig, &sa, (struct sigaction *)0));
+ return (sigaction(sig, &sa, NULL));
}
diff --git a/lib/libc/gen/signal.c b/lib/libc/gen/signal.c
index 03a6fa3d5a2..0ca411bca64 100644
--- a/lib/libc/gen/signal.c
+++ b/lib/libc/gen/signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.c,v 1.8 2015/09/09 16:10:03 guenther Exp $ */
+/* $OpenBSD: signal.c,v 1.9 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 1985, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -47,7 +47,7 @@ signal(int s, sig_t a)
sa.sa_flags = 0;
if (!sigismember(&__sigintr, s))
sa.sa_flags |= SA_RESTART;
- if (sigaction(s, &sa, &osa) < 0)
+ if (WRAP(sigaction)(s, &sa, &osa) < 0)
return (SIG_ERR);
return (osa.sa_handler);
}
diff --git a/lib/libc/hidden/signal.h b/lib/libc/hidden/signal.h
index 53b4998f9d9..10bb3e41884 100644
--- a/lib/libc/hidden/signal.h
+++ b/lib/libc/hidden/signal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.h,v 1.7 2015/09/19 04:02:21 guenther Exp $ */
+/* $OpenBSD: signal.h,v 1.8 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
*
@@ -33,9 +33,9 @@ PROTO_DEPRECATED(bsd_signal);
PROTO_NORMAL(kill); /* wrap to ban SIGTHR? */
PROTO_DEPRECATED(killpg);
PROTO_DEPRECATED(psignal);
-/*PROTO_NORMAL(pthread_sigmask);*/
+PROTO_DEPRECATED(pthread_sigmask);
PROTO_NORMAL(raise);
-/*PROTO_WRAP(sigaction); wrap to hide SIGTHR */
+PROTO_WRAP(sigaction);
PROTO_NORMAL(sigaddset);
PROTO_NORMAL(sigaltstack);
PROTO_NORMAL(sigblock);
@@ -46,8 +46,8 @@ PROTO_DEPRECATED(siginterrupt);
PROTO_NORMAL(sigismember);
PROTO_NORMAL(signal);
PROTO_DEPRECATED(sigpause);
-/*PROTO_NORMAL(sigpending); wrap to hide SIGTHR */
-/*PROTO_WRAP(sigprocmask); wrap to hide SIGTHR */
+PROTO_NORMAL(sigpending);
+PROTO_WRAP(sigprocmask);
PROTO_NORMAL(sigreturn);
PROTO_NORMAL(sigsetmask);
/*PROTO_CANCEL(sigsuspend); wrap to hide SIGTHR */
diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h
index cfdb95ad023..569668d0acf 100644
--- a/lib/libc/include/namespace.h
+++ b/lib/libc/include/namespace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: namespace.h,v 1.7 2015/09/11 09:18:27 guenther Exp $ */
+/* $OpenBSD: namespace.h,v 1.8 2015/10/23 04:39:24 guenther Exp $ */
#ifndef _LIBC_NAMESPACE_H_
#define _LIBC_NAMESPACE_H_
@@ -69,7 +69,7 @@
*
* WRAP(x)
* This expands to the internal, hidden name of a non-cancellation
- * wrapper: _libc_x_wrap. ex: WRAP(sigpending)(set)
+ * wrapper: _libc_x_wrap. ex: WRAP(sigprocmask)(set)
*
*
* In order to actually set up the desired asm labels, we use these in
@@ -91,8 +91,9 @@
* ex: PROTO_CANCEL(wait4)
*
* PROTO_WRAP(x) Functions that have wrappers for other reasons
- * This makes gcc convert use of x to use _libc_x_wrap instead.
- * ex: PROTO_WRAP(setlogin)
+ * Like PROTO_NORMAL(x), but also declares _libc_x_wrap. Internal
+ * calls that want the wrapper's processing should invoke WRAP(x)(...)
+ * ex: PROTO_WRAP(sigaction)
*
*
* Finally, to create the expected aliases, we use these in the .c files
@@ -144,7 +145,7 @@
#define PROTO_STD_DEPRECATED(x) typeof(x) x __attribute__((deprecated))
#define PROTO_DEPRECATED(x) typeof(x) x __attribute__((deprecated, weak))
#define PROTO_CANCEL(x) PROTO_NORMAL(x), CANCEL(x)
-#define PROTO_WRAP(x) __dso_hidden typeof(x) x asm(WRAP_STRING(x))
+#define PROTO_WRAP(x) PROTO_NORMAL(x), WRAP(x)
#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x))
#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x))
diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c
index 903bfa78e18..710cd7da478 100644
--- a/lib/libc/stdlib/abort.c
+++ b/lib/libc/stdlib/abort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: abort.c,v 1.18 2015/09/13 08:31:47 guenther Exp $ */
+/* $OpenBSD: abort.c,v 1.19 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved.
@@ -34,7 +34,6 @@
#include "thread_private.h"
#include "atexit.h"
-int _thread_sys_sigprocmask(int, const sigset_t *, sigset_t *);
void
abort(void)
@@ -48,7 +47,7 @@ abort(void)
* any errors -- X311J doesn't allow abort to return anyway.
*/
sigdelset(&mask, SIGABRT);
- (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
+ (void)sigprocmask(SIG_SETMASK, &mask, NULL);
(void)raise(SIGABRT);
@@ -57,7 +56,7 @@ abort(void)
* it again, only harder.
*/
(void)signal(SIGABRT, SIG_DFL);
- (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
+ (void)sigprocmask(SIG_SETMASK, &mask, NULL);
(void)raise(SIGABRT);
_exit(1);
}
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 6a8dbaf7b3d..9fa5eb947d2 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.134 2015/10/23 00:52:49 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.135 2015/10/23 04:39:24 guenther Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
@@ -11,7 +11,8 @@ SRCS+= Ovfork.S brk.S cerror.S fork.S \
sigsuspend.S syscall.S tfork_thread.S
# glue to offer userland wrappers for some syscalls
-SRCS+= posix_madvise.c w_fork.c
+SRCS+= posix_madvise.c pthread_sigmask.c \
+ w_fork.c w_sigaction.c w_sigprocmask.c
# glue to provide compatibility between GCC 1.X and 2.X and for compat
# with old syscall interfaces.
@@ -54,7 +55,7 @@ ASM= __get_tcb.o __getcwd.o __semctl.o __set_tcb.o __syscall.o \
setpgid.o setpriority.o setregid.o setresgid.o setresuid.o \
setreuid.o setrlimit.o setrtable.o setsid.o setsockopt.o \
settimeofday.o setuid.o shmat.o shmctl.o shmdt.o \
- shmget.o shutdown.o sigaction.o sigaltstack.o socket.o \
+ shmget.o shutdown.o sigaltstack.o socket.o \
socketpair.o stat.o statfs.o swapctl.o symlink.o symlinkat.o \
sync.o sysarch.o sysctl.o umask.o unlink.o unlinkat.o \
unmount.o utimensat.o utimes.o utrace.o wait4.o write.o writev.o
@@ -81,7 +82,13 @@ PPSEUDO_NOERR=${PSEUDO_NOERR:.o=.po}
SPSEUDO_NOERR=${PSEUDO_NOERR:.o=.so}
DPSEUDO_NOERR=${PSEUDO_NOERR:.o=.do}
-OBJS+= ${ASM} ${PSEUDO} ${PSEUDO_NOERR}
+HIDDEN= sigaction.o
+GHIDDEN=${HIDDEN:.o=.go}
+PHIDDEN=${HIDDEN:.o=.po}
+SHIDDEN=${HIDDEN:.o=.so}
+DHIDDEN=${HIDDEN:.o=.do}
+
+OBJS+= ${ASM} ${PSEUDO} ${PSEUDO_NOERR} ${HIDDEN}
SYS_DEP = ${LIBCSRCDIR}/arch/${MACHINE_CPU}/SYS.h /usr/include/sys/syscall.h
@@ -100,6 +107,9 @@ GENERATE.pseudo=\
GENERATE.pseudo_noerr=\
echo creating ${.TARGET} && \
printf '\#include "SYS.h"\nPSEUDO_NOERROR(${.PREFIX},${.PREFIX:S/_//})\n'
+GENERATE.rsyscall_hidden=\
+ echo creating ${.TARGET} && \
+ printf '\#include "SYS.h"\nRSYSCALL_HIDDEN(${.PREFIX:S/_//})\n'
# ...and one of these to control how it's compiled
FINISH= ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} -x assembler-with-cpp -
@@ -128,6 +138,12 @@ ${SPSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.so}
${DPSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.do}
${PSEUDO_NOERR}: ${SYS_DEP} ; @${GENERATE.pseudo_noerr} | ${FINISH.o}
+${GHIDDEN}: ${SYS_DEP} ; @${GENERATE.rsyscall_hidden} | ${FINISH.go}
+${PHIDDEN}: ${SYS_DEP} ; @${GENERATE.rsyscall_hidden} | ${FINISH.po}
+${SHIDDEN}: ${SYS_DEP} ; @${GENERATE.rsyscall_hidden} | ${FINISH.so}
+${DHIDDEN}: ${SYS_DEP} ; @${GENERATE.rsyscall_hidden} | ${FINISH.do}
+${HIDDEN}: ${SYS_DEP} ; @${GENERATE.rsyscall_hidden} | ${FINISH.o}
+
MAN+= __get_tcb.2 __thrsigdivert.2 __thrsleep.2 _exit.2 accept.2 \
access.2 acct.2 adjfreq.2 adjtime.2 bind.2 brk.2 chdir.2 \
diff --git a/lib/libc/sys/pthread_sigmask.c b/lib/libc/sys/pthread_sigmask.c
new file mode 100644
index 00000000000..19dfd56a253
--- /dev/null
+++ b/lib/libc/sys/pthread_sigmask.c
@@ -0,0 +1,26 @@
+/* $OpenBSD: pthread_sigmask.c,v 1.1 2015/10/23 04:39:24 guenther Exp $ */
+/*
+ * Copyright (c) 2005 Ted Unangst <tedu@openbsd.org>
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <signal.h>
+#include <errno.h>
+
+int
+pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
+{
+ return (WRAP(sigprocmask)(how, set, oset) ? errno : 0);
+}
diff --git a/lib/libc/sys/w_sigaction.c b/lib/libc/sys/w_sigaction.c
new file mode 100644
index 00000000000..263365b8aa2
--- /dev/null
+++ b/lib/libc/sys/w_sigaction.c
@@ -0,0 +1,41 @@
+/* $OpenBSD: w_sigaction.c,v 1.1 2015/10/23 04:39:24 guenther Exp $ */
+/*
+ * Copyright (c) 2005 Ted Unangst <tedu@openbsd.org>
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * signals
+ */
+
+#include <signal.h>
+#include <errno.h>
+
+int
+WRAP(sigaction)(int sig, const struct sigaction *act, struct sigaction *oact)
+{
+ struct sigaction sa;
+
+ if (sig == SIGTHR) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if (act != NULL && sigismember(&act->sa_mask, SIGTHR)) {
+ sa = *act;
+ sigdelset(&sa.sa_mask, SIGTHR);
+ act = &sa;
+ }
+ return (sigaction(sig, act, oact));
+}
+DEF_WRAP(sigaction);
diff --git a/lib/libc/sys/w_sigprocmask.c b/lib/libc/sys/w_sigprocmask.c
new file mode 100644
index 00000000000..1b4b843570e
--- /dev/null
+++ b/lib/libc/sys/w_sigprocmask.c
@@ -0,0 +1,37 @@
+/* $OpenBSD: w_sigprocmask.c,v 1.1 2015/10/23 04:39:24 guenther Exp $ */
+/*
+ * Copyright (c) 2005 Ted Unangst <tedu@openbsd.org>
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * signals
+ */
+
+#include <signal.h>
+#include <errno.h>
+
+int
+WRAP(sigprocmask)(int how, const sigset_t *set, sigset_t *oset)
+{
+ sigset_t s;
+
+ if (set != NULL && how != SIG_UNBLOCK && sigismember(set, SIGTHR)) {
+ s = *set;
+ sigdelset(&s, SIGTHR);
+ set = &s;
+ }
+ return (sigprocmask(how, set, oset));
+}
+DEF_WRAP(sigprocmask);
diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c
index c0c692d021b..944e56f8bf6 100644
--- a/lib/librthread/rthread.c
+++ b/lib/librthread/rthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread.c,v 1.84 2015/10/18 08:02:58 guenther Exp $ */
+/* $OpenBSD: rthread.c,v 1.85 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 2004,2005 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -220,7 +220,7 @@ _rthread_init(void)
sa.sa_handler = sigthr_handler;
_thread_sys_sigaction(SIGTHR, &sa, NULL);
sigaddset(&sa.sa_mask, SIGTHR);
- sigprocmask(SIG_UNBLOCK, &sa.sa_mask, NULL);
+ _thread_sys_sigprocmask(SIG_UNBLOCK, &sa.sa_mask, NULL);
return (0);
}
@@ -757,8 +757,6 @@ static void *__libc_overrides[] __used = {
&select,
&sendmsg,
&sendto,
- &sigaction,
- &sigprocmask,
&sigsuspend,
&vfork,
&wait4,
diff --git a/lib/librthread/rthread_sig.c b/lib/librthread/rthread_sig.c
index 3c5ec8a59c1..3fbf9b4c200 100644
--- a/lib/librthread/rthread_sig.c
+++ b/lib/librthread/rthread_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_sig.c,v 1.16 2014/11/16 05:24:25 guenther Exp $ */
+/* $OpenBSD: rthread_sig.c,v 1.17 2015/10/23 04:39:24 guenther Exp $ */
/*
* Copyright (c) 2005 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -27,25 +27,6 @@
#include "rthread.h"
int
-pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
-{
- return (sigprocmask(how, set, oset) ? errno : 0);
-}
-
-int
-sigprocmask(int how, const sigset_t *set, sigset_t *oset)
-{
- sigset_t s;
-
- if (set != NULL && how != SIG_UNBLOCK && sigismember(set, SIGTHR)) {
- s = *set;
- sigdelset(&s, SIGTHR);
- set = &s;
- }
- return (_thread_sys_sigprocmask(how, set, oset));
-}
-
-int
sigwait(const sigset_t *set, int *sig)
{
pthread_t self = pthread_self();
@@ -94,20 +75,3 @@ sigtimedwait(const sigset_t *set, siginfo_t *info,
return (ret);
}
#endif
-
-int
-sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
-{
- struct sigaction sa;
-
- if (sig == SIGTHR) {
- errno = EINVAL;
- return (-1);
- }
- if (act != NULL && sigismember(&act->sa_mask, SIGTHR)) {
- sa = *act;
- sigdelset(&sa.sa_mask, SIGTHR);
- act = &sa;
- }
- return (_thread_sys_sigaction(sig, act, oact));
-}
diff --git a/lib/librthread/shlib_version b/lib/librthread/shlib_version
index 0aab0406bf8..a5757c1bcc6 100644
--- a/lib/librthread/shlib_version
+++ b/lib/librthread/shlib_version
@@ -1,2 +1,2 @@
-major=19
+major=20
minor=0