From 0318167b7689b32eb9d5c7f8d5de7eada56299b7 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Fri, 23 Oct 2015 04:39:24 +0000 Subject: 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@ --- src/lib/libc/include/namespace.h | 11 ++++++----- src/lib/libc/stdlib/abort.c | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/lib') 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 @@ -/* $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/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 @@ -/* $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); } -- cgit v1.2.3-55-g6feb