* MODULES.html.sh (Support for systems lacking POSIX:2008): Add it.
* doc/posix-functions/pthread_sigmask.texi: Document new module.
* lib/signal.in.h (pthread_sigmask): Arrange for replacement.
This is done only as a macro; I don't know how well that'll
work for C++. Move <sys/types.h> include before the include_next,
to avoid mishap on Solaris.
* m4/signal_h.m4 (gl_SIGNAL_H, gl_SIGNAL_H_DEFAULTS): Check for it.
* modules/signal (Makefile.am): Substitute the check's results.
* modules/pthread_sigmask, m4/pthread_sigmask.m4: New files.
2011-07-05 Paul Eggert <eggert@cs.ucla.edu>
+ pthread_sigmask: new module
+ * MODULES.html.sh (Support for systems lacking POSIX:2008): Add it.
+ * doc/posix-functions/pthread_sigmask.texi: Document new module.
+ * lib/signal.in.h (pthread_sigmask): Arrange for replacement.
+ This is done only as a macro; I don't know how well that'll
+ work for C++. Move <sys/types.h> include before the include_next,
+ to avoid mishap on Solaris.
+ * m4/signal_h.m4 (gl_SIGNAL_H, gl_SIGNAL_H_DEFAULTS): Check for it.
+ * modules/signal (Makefile.am): Substitute the check's results.
+ * modules/pthread_sigmask, m4/pthread_sigmask.m4: New files.
+
test-pselect: new module
* modules/pselect-tests, tests/test-pselect.c: New files.
* tests/test-select.c, tests/test-sys_select-c++.cc:
func_module times
func_module timespec
func_module nanosleep
+ func_module pthread_sigmask
func_module regex
func_module rename
func_module renameat
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.4, mingw, BeOS.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.4, mingw, BeOS.
+On platforms that do not natively support this function,
+it has unspecified behavior in a multi-threaded process.
@end itemize
#ifndef _@GUARD_PREFIX@_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
+ us; so include <sys/types.h> now, before the second inclusion guard. */
+#include <sys/types.h>
+
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
/* The definition of _GL_WARN_ON_USE is copied here. */
-/* Define pid_t, uid_t.
- Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
-#include <sys/types.h>
-
/* On AIX, sig_atomic_t already includes volatile. C99 requires that
'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
Hence, redefine this to a non-volatile type as needed. */
#endif
+#if @GNULIB_PTHREAD_SIGMASK@
+# if @REPLACE_PTHREAD_SIGMASK@
+# undef pthread_sigmask
+# define pthread_sigmask sigprocmask
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pthread_sigmask
+# if HAVE_RAW_DECL_PTHREAD_SIGMASK
+_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
+ "use gnulib module pthread_sigmask for portability");
+# endif
+#endif
+
+
#if @GNULIB_SIGPROCMASK@
# if !@HAVE_POSIX_SIGNALBLOCKING@
--- /dev/null
+# pthread_sigmask.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_PTHREAD_SIGMASK],
+[
+ m4_ifdef([gl_THREADLIB], [
+ AC_REQUIRE([gl_THREADLIB])
+ if test "$gl_threads_api" = posix; then
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBMULTITHREAD"
+ AC_CHECK_FUNCS([pthread_sigmask])
+ LIBS="$gl_save_LIBS"
+ fi
+ ], [
+ AC_CHECK_FUNCS_ONCE([pthread_sigmask])
+ ])
+
+ if test $ac_cv_func_pthread_sigmask = no; then
+ REPLACE_PTHREAD_SIGMASK=0
+ fi
+])
-# signal_h.m4 serial 12
+# signal_h.m4 serial 13
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <signal.h>
- ]], [sigaction sigaddset sigdelset sigemptyset sigfillset sigismember
+ ]], [pthread_sigmask sigaction
+ sigaddset sigdelset sigemptyset sigfillset sigismember
sigpending sigprocmask])
])
AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
[
+ GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK])
GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T])
+ REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK])
])
--- /dev/null
+Description:
+POSIX compatible signal blocking for threads.
+
+Files:
+m4/pthread_sigmask.m4
+
+Depends-on:
+signal
+sigprocmask [test $REPLACE_PTHREAD_SIGMASK = 1]
+
+configure.ac:
+gl_PTHREAD_SIGMASK
+gl_SYS_SELECT_MODULE_INDICATOR([pthread_sigmask])
+
+Makefile.am:
+
+Include:
+<signal.h>
+
+Link:
+$(LIBMULTITHREAD)
+
+License:
+LGPLv2+
+
+Maintainer:
+Paul Eggert, Bruno Haible, Jim Meyering
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
+ -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \
-e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \
-e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \
-e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \
-e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
-e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
-e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
+ -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \