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@
preadv
profil
pselect
+pthread_sigmask
ptrace
pwrite
pwritev
-/* $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 $ */
/*
# 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)
-/* $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 $ */
/*
stl v0, 0(a0)
mov zero, v0
RET
-SYSEND(sigpending)
+SYSCALL_END(sigpending)
-/* $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 $ */
/*
#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. */
Lret: mov zero, v0
RET
-SYSEND(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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 $ */
/*
CALLSYS_ERROR(sigsuspend)
mov zero, v0 /* shouldn't need; just in case... */
RET
-SYSEND(sigsuspend)
+SYSCALL_END(sigsuspend)
-/* $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.
#define SYSCALL_NOERROR(x) \
_SYSCALL_NOERROR(x,x)
+#define SYSCALL_HIDDEN(x) \
+ _SYSCALL_HIDDEN(x,x)
#define SYSCALL(x) \
_SYSCALL(x,x)
-/* $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 $ */
/*-
#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
#else
jmp CERROR
#endif
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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 $ */
/*-
PSEUDO_HIDDEN(x,x)
#define SYSCALL_END(x) \
__END(x)
+#define SYSCALL_END_HIDDEN(x) \
+ __END_HIDDEN(x)
.globl CERROR
-/* $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 $ */
/*-
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
teq r1, #0x00000000
moveq r0, #0x00000001
moveq r1, #0x00000000
strne r0, [r2]
mov r0, #0x00000000
mov r15, r14
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
/* just in case compiler forgot about this */
stw arg2, HPPA_FRAME_ARG(2)(sp)
stw ret0, 0(arg2)
bv r0(rp)
copy r0, ret0
-SYSEXIT(sigprocmask)
+SYSEXIT_HIDDEN(sigprocmask)
.end
-/* $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
#include "SYS.h"
-SYSENTRY(sigprocmask)
+SYSENTRY_HIDDEN(sigprocmask)
std %arg2, HPPA_FRAME_ARG(2)(%sp)
comb,<>,n %r0, %arg1, sigprocmask$nblock
stw %ret0, 0(%arg2)
bv %r0(%rp)
copy %r0, %ret0
-SYSEXIT(sigprocmask)
+SYSEXIT_HIDDEN(sigprocmask)
.end
* 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>
#define RSYSCALL_HIDDEN(x) \
PSEUDO_HIDDEN(x,x)
#define SYSCALL_END(x) __END(x)
+#define SYSCALL_END_HIDDEN(x) \
+ __END_HIDDEN(x)
.globl CERROR
-/* $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.
#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
#else
jmp CERROR
#endif
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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.
#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
-/* $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.
#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
3:
jmp.n %r1
or %r2,%r0,0
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
* 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>
# 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); \
#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; \
#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; \
#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)
-/* $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.
SYSLEAF(sigpending, FRAMESZ)
PTR_SUBU sp, FRAMESZ
- SETUP_GP64(GPOFF, sigpending)
+ SETUP_GP64(GPOFF, _HIDDEN(sigpending))
.set reorder
li v0, SYS_sigpending
syscall
RESTORE_GP64
PTR_ADDU sp, FRAMESZ
jr t9
-SYSEND(sigpending)
+SYSCALL_END(sigpending)
-/* $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.
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
RESTORE_GP64
PTR_ADDU sp, FRAMESZ
jr t9
-SYSEND(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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.
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
RESTORE_GP64
PTR_ADDU sp, FRAMESZ
jr t9
-SYSEND(sigsuspend)
+SYSCALL_END(sigsuspend)
-/* $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.
#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 ; \
#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)
-/* $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
#include "SYS.h"
.text
-PREFIX(sigprocmask)
+PREFIX_HIDDEN(sigprocmask)
stwu 1, -16(1)
stw 5, 12(1)
li 3, 0
addi 1, 1, 16
blr
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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.
#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
-/* $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 $ */
/*-
#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 */
.align 2
LSYS_sigprocmask:
.long SYS_sigprocmask
-SYSCALL_END(sigpending)
+SYSCALL_END_HIDDEN(sigpending)
* 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"
# 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)
-/* $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.
/*
* 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
3:
retl ! in any case, return 0
clr %o0
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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.
/*
* 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)
-/* $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.
/*
* 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 ... */
3:
retl /* in any case, return 0 */
clr %o0
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
-/* $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 $ */
/*
*/
#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)
#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)
-/* $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.
#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 */
ret
4:
jmp _C_LABEL(__cerror)
-SYSCALL_END(sigprocmask)
+SYSCALL_END_HIDDEN(sigprocmask)
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 */
{
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);
{
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);
-/* $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.
/* 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);
}
-/* $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.
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);
sigdelset(&__sigintr, sig);
sa.sa_flags |= SA_RESTART;
}
- return (sigaction(sig, &sa, (struct sigaction *)0));
+ return (sigaction(sig, &sa, NULL));
}
-/* $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.
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);
}
-/* $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>
*
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);
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 */
-/* $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_
*
* 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
* 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
#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))
-/* $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.
#include "thread_private.h"
#include "atexit.h"
-int _thread_sys_sigprocmask(int, const sigset_t *, sigset_t *);
void
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);
* 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);
}
-# $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
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.
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
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
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 -
${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 \
--- /dev/null
+/* $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);
+}
--- /dev/null
+/* $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);
--- /dev/null
+/* $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);
-/* $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.
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);
}
&select,
&sendmsg,
&sendto,
- &sigaction,
- &sigprocmask,
&sigsuspend,
&vfork,
&wait4,
-/* $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.
#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)
{
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));
-}
-major=19
+major=20
minor=0