summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguenther <>2015-10-23 04:39:24 +0000
committerguenther <>2015-10-23 04:39:24 +0000
commit0318167b7689b32eb9d5c7f8d5de7eada56299b7 (patch)
treec03c5fcb25ad2078365518e9089e736909cc59ae
parent3dd284a67fd444a40f7de3ef07b8d29b0dfc6e78 (diff)
downloadopenbsd-0318167b7689b32eb9d5c7f8d5de7eada56299b7.tar.gz
openbsd-0318167b7689b32eb9d5c7f8d5de7eada56299b7.tar.bz2
openbsd-0318167b7689b32eb9d5c7f8d5de7eada56299b7.zip
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@
-rw-r--r--src/lib/libc/include/namespace.h11
-rw-r--r--src/lib/libc/stdlib/abort.c7
2 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h
index cfdb95ad02..569668d0ac 100644
--- a/src/lib/libc/include/namespace.h
+++ b/src/lib/libc/include/namespace.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: namespace.h,v 1.7 2015/09/11 09:18:27 guenther Exp $ */ 1/* $OpenBSD: namespace.h,v 1.8 2015/10/23 04:39:24 guenther Exp $ */
2 2
3#ifndef _LIBC_NAMESPACE_H_ 3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_ 4#define _LIBC_NAMESPACE_H_
@@ -69,7 +69,7 @@
69 * 69 *
70 * WRAP(x) 70 * WRAP(x)
71 * This expands to the internal, hidden name of a non-cancellation 71 * This expands to the internal, hidden name of a non-cancellation
72 * wrapper: _libc_x_wrap. ex: WRAP(sigpending)(set) 72 * wrapper: _libc_x_wrap. ex: WRAP(sigprocmask)(set)
73 * 73 *
74 * 74 *
75 * In order to actually set up the desired asm labels, we use these in 75 * In order to actually set up the desired asm labels, we use these in
@@ -91,8 +91,9 @@
91 * ex: PROTO_CANCEL(wait4) 91 * ex: PROTO_CANCEL(wait4)
92 * 92 *
93 * PROTO_WRAP(x) Functions that have wrappers for other reasons 93 * PROTO_WRAP(x) Functions that have wrappers for other reasons
94 * This makes gcc convert use of x to use _libc_x_wrap instead. 94 * Like PROTO_NORMAL(x), but also declares _libc_x_wrap. Internal
95 * ex: PROTO_WRAP(setlogin) 95 * calls that want the wrapper's processing should invoke WRAP(x)(...)
96 * ex: PROTO_WRAP(sigaction)
96 * 97 *
97 * 98 *
98 * Finally, to create the expected aliases, we use these in the .c files 99 * Finally, to create the expected aliases, we use these in the .c files
@@ -144,7 +145,7 @@
144#define PROTO_STD_DEPRECATED(x) typeof(x) x __attribute__((deprecated)) 145#define PROTO_STD_DEPRECATED(x) typeof(x) x __attribute__((deprecated))
145#define PROTO_DEPRECATED(x) typeof(x) x __attribute__((deprecated, weak)) 146#define PROTO_DEPRECATED(x) typeof(x) x __attribute__((deprecated, weak))
146#define PROTO_CANCEL(x) PROTO_NORMAL(x), CANCEL(x) 147#define PROTO_CANCEL(x) PROTO_NORMAL(x), CANCEL(x)
147#define PROTO_WRAP(x) __dso_hidden typeof(x) x asm(WRAP_STRING(x)) 148#define PROTO_WRAP(x) PROTO_NORMAL(x), WRAP(x)
148 149
149#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x)) 150#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x))
150#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x)) 151#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x))
diff --git a/src/lib/libc/stdlib/abort.c b/src/lib/libc/stdlib/abort.c
index 903bfa78e1..710cd7da47 100644
--- a/src/lib/libc/stdlib/abort.c
+++ b/src/lib/libc/stdlib/abort.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: abort.c,v 1.18 2015/09/13 08:31:47 guenther Exp $ */ 1/* $OpenBSD: abort.c,v 1.19 2015/10/23 04:39:24 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1985 Regents of the University of California. 3 * Copyright (c) 1985 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -34,7 +34,6 @@
34#include "thread_private.h" 34#include "thread_private.h"
35#include "atexit.h" 35#include "atexit.h"
36 36
37int _thread_sys_sigprocmask(int, const sigset_t *, sigset_t *);
38 37
39void 38void
40abort(void) 39abort(void)
@@ -48,7 +47,7 @@ abort(void)
48 * any errors -- X311J doesn't allow abort to return anyway. 47 * any errors -- X311J doesn't allow abort to return anyway.
49 */ 48 */
50 sigdelset(&mask, SIGABRT); 49 sigdelset(&mask, SIGABRT);
51 (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); 50 (void)sigprocmask(SIG_SETMASK, &mask, NULL);
52 51
53 (void)raise(SIGABRT); 52 (void)raise(SIGABRT);
54 53
@@ -57,7 +56,7 @@ abort(void)
57 * it again, only harder. 56 * it again, only harder.
58 */ 57 */
59 (void)signal(SIGABRT, SIG_DFL); 58 (void)signal(SIGABRT, SIG_DFL);
60 (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); 59 (void)sigprocmask(SIG_SETMASK, &mask, NULL);
61 (void)raise(SIGABRT); 60 (void)raise(SIGABRT);
62 _exit(1); 61 _exit(1);
63} 62}