From: Bruno Haible <bruno@clisp.org>
Date: Fri, 8 Jul 2011 00:24:27 +0000 (+0200)
Subject: pthread_sigmask: Ensure declaration in <signal.h>.
X-Git-Tag: v0.1~2158
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=b8b7afdc8e2e8c2bb512d822d8a4b26a1a34eb8f;p=gnulib.git

pthread_sigmask: Ensure declaration in <signal.h>.

* lib/signal.in.h: On MacOS X, FreeBSD, OpenBSD, OSF/1, include
<pthread.h>.
* doc/posix-functions/pthread_sigmask.texi: Mention the header file
problem.
---

diff --git a/ChangeLog b/ChangeLog
index fec1eceb95..865313641b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-07-07  Bruno Haible  <bruno@clisp.org>
+
+	pthread_sigmask: Ensure declaration in <signal.h>.
+	* lib/signal.in.h: On MacOS X, FreeBSD, OpenBSD, OSF/1, include
+	<pthread.h>.
+	* doc/posix-functions/pthread_sigmask.texi: Mention the header file
+	problem.
+
 2011-07-07  Bruno Haible  <bruno@clisp.org>
 
 	pthread_sigmask: Document the module.
diff --git a/doc/posix-functions/pthread_sigmask.texi b/doc/posix-functions/pthread_sigmask.texi
index eb2d7b87d4..2f62c1b70e 100644
--- a/doc/posix-functions/pthread_sigmask.texi
+++ b/doc/posix-functions/pthread_sigmask.texi
@@ -11,6 +11,10 @@ Portability problems fixed by Gnulib:
 @item
 This function is missing on some platforms:
 Solaris 2.4, mingw, BeOS.
+@item
+This function is declared in @code{<pthread.h>} instead of @code{<signal.h>}
+on some platforms:
+MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 6d1be8fb89..ea227726e2 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -55,6 +55,15 @@
 #ifndef _@GUARD_PREFIX@_SIGNAL_H
 #define _@GUARD_PREFIX@_SIGNAL_H
 
+/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0 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 __GLIBC__
+# include <pthread.h>
+#endif
+
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */