summaryrefslogtreecommitdiff
path: root/lib/signal.in.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-08 13:20:19 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-08 13:20:19 -0700
commit2a84b02da8b20138fad7fafdea92d7c8f0564ee0 (patch)
treeda64c1fd303aa85b53ad485779b05fbdd2685a28 /lib/signal.in.h
parent1692ae2dd5ff8f6f1fc6f6f62b9a44ab7e615615 (diff)
downloademacs-2a84b02da8b20138fad7fafdea92d7c8f0564ee0.tar.gz
Simplify Emacs part of pthread_sigmask support.
* Makefile.in (GNULIB_TOOL_FLAGS): Do not avoid sigprocmask. * configure.in (AC_TYPE_UID_T): New dummy macro. Configure gnulib after adjusting LIBS, so that gnulib can assume the libraries in LIBS. * lib/pthread_sigmask.c, lib/sigprocmask.c, m4/signalblocking.m4: New files, automatically imported from gnulib. * lib/gnulib.mk, m4/gl-comp.m4: Regenerate. * src/Makefile.in (LIB_PTHREAD_SIGMASK): New macro. (LIBES): Use it.
Diffstat (limited to 'lib/signal.in.h')
-rw-r--r--lib/signal.in.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 01987a7aff1..93787f753fa 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -20,8 +20,17 @@
#endif
@PRAGMA_COLUMNS@
-#if defined __need_sig_atomic_t || defined __need_sigset_t
-/* Special invocation convention inside glibc header files. */
+#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
+/* Special invocation convention:
+ - Inside glibc header files.
+ - On glibc systems we have a sequence of nested includes
+ <signal.h> -> <ucontext.h> -> <signal.h>.
+ In this situation, the functions are not yet declared, therefore we cannot
+ provide the C++ aliases.
+ - On glibc systems with GCC 4.3 we have a sequence of nested includes
+ <csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>.
+ In this situation, some of the functions are not yet declared, therefore
+ we cannot provide the C++ aliases. */
# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
@@ -30,6 +39,8 @@
#ifndef _@GUARD_PREFIX@_SIGNAL_H
+#define _GL_ALREADY_INCLUDING_SIGNAL_H
+
/* Define pid_t, uid_t.
Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
@@ -39,9 +50,20 @@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
+#undef _GL_ALREADY_INCLUDING_SIGNAL_H
+
#ifndef _@GUARD_PREFIX@_SIGNAL_H
#define _@GUARD_PREFIX@_SIGNAL_H
+/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
+ pthread_sigmask in <pthread.h>, not in <signal.h>.
+ But avoid namespace pollution on glibc systems.*/
+#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
+ && ((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ || defined __sun) \
+ && ! defined __GLIBC__
+# include <pthread.h>
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -104,9 +126,23 @@ typedef void (*sighandler_t) (int);
#if @GNULIB_PTHREAD_SIGMASK@
# if @REPLACE_PTHREAD_SIGMASK@
-# undef pthread_sigmask
-# define pthread_sigmask sigprocmask
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef pthread_sigmask
+# define pthread_sigmask rpl_pthread_sigmask
+# endif
+_GL_FUNCDECL_RPL (pthread_sigmask, int,
+ (int how, const sigset_t *new_mask, sigset_t *old_mask));
+_GL_CXXALIAS_RPL (pthread_sigmask, int,
+ (int how, const sigset_t *new_mask, sigset_t *old_mask));
+# else
+# if !@HAVE_PTHREAD_SIGMASK@
+_GL_FUNCDECL_SYS (pthread_sigmask, int,
+ (int how, const sigset_t *new_mask, sigset_t *old_mask));
+# endif
+_GL_CXXALIAS_SYS (pthread_sigmask, int,
+ (int how, const sigset_t *new_mask, sigset_t *old_mask));
# endif
+_GL_CXXALIASWARN (pthread_sigmask);
#elif defined GNULIB_POSIXCHECK
# undef pthread_sigmask
# if HAVE_RAW_DECL_PTHREAD_SIGMASK