bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9000: Update time patch for Frandom, pthread_sigmask, etc.


From: Paul Eggert
Subject: bug#9000: Update time patch for Frandom, pthread_sigmask, etc.
Date: Wed, 06 Jul 2011 10:00:13 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

Here are three minor updates to the previous patch for high-resolution
time stamps, to accommodate recent changes to Emacs and to gnulib.
Almost all of this is automatically generated.  I don't think this
affects the Windows build (although the last patch builds a wrapper
for signal.h, to support pthread_sigmask, this is irrelevant for
Windows), but I'm sending this as a heads-up, just in case.


* fns.c (Frandom): Use nanoseconds, not microseconds, for seed.
=== modified file 'src/fns.c'
--- src/fns.c   2011-07-05 02:51:15 +0000
+++ src/fns.c   2011-07-06 16:32:00 +0000
@@ -84,7 +84,7 @@
     {
       EMACS_TIME t;
       EMACS_GET_TIME (t);
-      seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_USECS (t));
+      seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t));
     }

   if (NATNUMP (limit) && XFASTINT (limit) != 0)

==============================================================================

* Makefile.in (GNULIB_TOOL_FLAGS): Add --avoid=select --avoid=sigprocmask.
This trims down the gnulib import, from the very latest gnulib.
Emacs does its own implementation of 'select' and 'sigprocmask'
on Windows, and it assumes 'select' and 'sigprocmask' on non-Windows
hosts, so it doesn't need these modules.
=== modified file 'Makefile.in'
--- Makefile.in 2011-07-01 06:21:22 +0000
+++ Makefile.in 2011-07-06 16:24:49 +0000
@@ -340,6 +340,7 @@
   symlink sys_stat sys_time \
   time timespec-add timespec-sub utimens
 GNULIB_TOOL_FLAGS = \
+ --avoid=select --avoid=sigprocmask \
  --conditional-dependencies --import --no-changelog --no-vc-files \
  --makefile-name=gnulib.mk
 sync-from-gnulib: $(gnulib_srcdir)

==============================================================================

=== modified file '.bzrignore'
--- .bzrignore  2011-06-27 04:31:43 +0000
+++ .bzrignore  2011-07-06 16:49:44 +0000
@@ -52,6 +52,7 @@
 lib/c++defs.h
 lib/getopt.h
 lib/inttypes.h
+lib/signal.h
 lib/stdbool.h
 lib/stdio.h
 lib/stdint.h

=== modified file 'ChangeLog'
--- ChangeLog   2011-07-06 16:42:05 +0000
+++ ChangeLog   2011-07-06 16:49:44 +0000
@@ -20,15 +20,18 @@
        This contains just the automatically-generated stuff from gnulib;
        a later patch will contain the more-interesting stuff.
        * lib/dtotimespec.c, lib/errno.in.h, lib/gettime.c:
-       * lib/gettimeofday.c, lib/pselect.c, lib/stat-time.h, lib/strtoll.c:
+       * lib/gettimeofday.c, lib/pselect.c, lib/signal.in.h:
+       * lib/stat-time.h, lib/strtoll.c:
        * lib/sys_select.in.h, lib/sys_time.in.h, lib/timespec-add.c:
        * lib/timespec-sub.c, lib/timespec.h, lib/utimens.c, lib/utimens.h:
        * m4/clock_time.m4, m4/errno_h.m4, m4/gettime.m4, m4/gettimeofday.m4:
-       * m4/pselect.m4, m4/stat-time.m4, m4/strtoimax.m4, m4/strtoll.m4:
+       * m4/pselect.m4, m4/pthread_sigmask.m4, m4/signal_h.m4:
+       * m4/stat-time.m4, m4/strtoimax.m4, m4/strtoll.m4:
        * m4/sys_select_h.m4, m4/sys_socket_h.m4, m4/sys_time_h.m4:
        * m4/timespec.m4, m4/utimbuf.m4, m4/utimens.m4, m4/utimes.m4:
        New files, copied automatically from gnulib.
        * lib/gnulib.mk, m4/gl-comp.m4: Merge from gnulib.
+       * .bzrignore: Add lib/signal.h.
 
 2011-07-05  Jan Djärv  <jan.h.d@swipnet.se>
 

=== modified file 'lib/gnulib.mk'
--- lib/gnulib.mk       2011-07-01 06:13:09 +0000
+++ lib/gnulib.mk       2011-07-06 16:49:44 +0000
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. 
--makefile-name=gnulib.mk --conditional-dependencies --no-libtool 
--macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 
crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg 
getopt-gnu gettime gettimeofday ignore-value intprops lstat mktime pselect 
readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink 
sys_stat sys_time time timespec-add timespec-sub utimens
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --avoid=select 
--avoid=sigprocmask --makefile-name=gnulib.mk --conditional-dependencies 
--no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 
crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode 
getloadavg getopt-gnu gettime gettimeofday ignore-value intprops lstat mktime 
pselect readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax 
symlink sys_stat sys_time time timespec-add timespec-sub utimens
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -367,6 +367,44 @@
 
 ## end   gnulib module readlink
 
+## begin gnulib module signal
+
+BUILT_SOURCES += signal.h
+
+# We need the following in order to create <signal.h> when the system
+# doesn't have a complete one.
+signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(WARN_ON_USE_H)
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -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_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
+             -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \
+             -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \
+             -e 's|@''HAVE_SIGACTION''@|$(HAVE_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)' \
+             < $(srcdir)/signal.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += signal.h signal.h-t
+
+EXTRA_DIST += signal.in.h
+
+## end   gnulib module signal
+
 ## begin gnulib module stat
 
 if gl_GNULIB_ENABLED_stat

=== modified file 'lib/pselect.c'
--- lib/pselect.c       2011-07-01 06:13:09 +0000
+++ lib/pselect.c       2011-07-06 16:49:44 +0000
@@ -27,8 +27,6 @@
 #include <errno.h>
 #include <signal.h>
 
-#undef pselect
-
 /* Examine the size-NFDS file descriptor sets in RFDS, WFDS, and XFDS
    to see whether some of their descriptors are ready for reading,
    ready for writing, or have exceptions pending.  Wait for at most
@@ -37,10 +35,10 @@
    or an unaffected signal mask.  */
 
 int
-rpl_pselect (int nfds, fd_set *restrict rfds,
-             fd_set *restrict wfds, fd_set *restrict xfds,
-             struct timespec const *restrict timeout,
-             sigset_t const *restrict sigmask)
+pselect (int nfds, fd_set *restrict rfds,
+         fd_set *restrict wfds, fd_set *restrict xfds,
+         struct timespec const *restrict timeout,
+         sigset_t const *restrict sigmask)
 {
   int select_result;
   sigset_t origmask;
@@ -64,14 +62,14 @@
   /* Signal mask munging should be atomic, but this is the best we can
      do in this emulation.  */
   if (sigmask)
-    sigprocmask (SIG_SETMASK, sigmask, &origmask);
+    pthread_sigmask (SIG_SETMASK, sigmask, &origmask);
 
   select_result = select (nfds, rfds, wfds, xfds, tvp);
 
   if (sigmask)
     {
       int select_errno = errno;
-      sigprocmask (SIG_SETMASK, &origmask, NULL);
+      pthread_sigmask (SIG_SETMASK, &origmask, NULL);
       errno = select_errno;
     }
 

=== added file 'lib/signal.in.h'
--- lib/signal.in.h     1970-01-01 00:00:00 +0000
+++ lib/signal.in.h     2011-07-06 16:49:44 +0000
@@ -0,0 +1,392 @@
+/* A GNU-like <signal.h>.
+
+   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined __need_sig_atomic_t || defined __need_sigset_t
+/* Special invocation convention inside glibc header files.  */
+
+# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
+
+#else
+/* Normal invocation convention.  */
+
+#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@
+
+#ifndef _@GUARD_PREFIX@_SIGNAL_H
+#define _@GUARD_PREFIX@_SIGNAL_H
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* 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.  */
+#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
+# if !GNULIB_defined_sig_atomic_t
+typedef int rpl_sig_atomic_t;
+#  undef sig_atomic_t
+#  define sig_atomic_t rpl_sig_atomic_t
+#  define GNULIB_defined_sig_atomic_t 1
+# endif
+#endif
+
+/* A set or mask of signals.  */
+#if !@HAVE_SIGSET_T@
+# if !GNULIB_defined_sigset_t
+typedef unsigned int sigset_t;
+#  define GNULIB_defined_sigset_t 1
+# endif
+#endif
+
+/* Define sighandler_t, the type of signal handlers.  A GNU extension.  */
+#if !@HAVE_SIGHANDLER_T@
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_sighandler_t
+typedef void (*sighandler_t) (int);
+#  define GNULIB_defined_sighandler_t 1
+# endif
+# ifdef __cplusplus
+}
+# endif
+#endif
+
+
+#if @GNULIB_SIGNAL_H_SIGPIPE@
+# ifndef SIGPIPE
+/* Define SIGPIPE to a value that does not overlap with other signals.  */
+#  define SIGPIPE 13
+#  define GNULIB_defined_SIGPIPE 1
+/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
+   'write', 'stdio'.  */
+# endif
+#endif
+
+
+/* Maximum signal number + 1.  */
+#ifndef NSIG
+# if defined __TANDEM
+#  define NSIG 32
+# endif
+#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@
+
+/* Maximum signal number + 1.  */
+#  ifndef NSIG
+#   define NSIG 32
+#  endif
+
+/* This code supports only 32 signals.  */
+#  if !GNULIB_defined_verify_NSIG_constraint
+typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
+#   define GNULIB_defined_verify_NSIG_constraint 1
+#  endif
+
+# endif
+
+/* Test whether a given signal is contained in a signal set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on MacOS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigismember
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
+                                    _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
+_GL_CXXALIASWARN (sigismember);
+
+/* Initialize a signal set to the empty set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on MacOS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigemptyset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
+_GL_CXXALIASWARN (sigemptyset);
+
+/* Add a signal to a signal set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on MacOS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigaddset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
+                                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
+_GL_CXXALIASWARN (sigaddset);
+
+/* Remove a signal from a signal set.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on MacOS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigdelset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
+                                  _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
+_GL_CXXALIASWARN (sigdelset);
+
+/* Fill a signal set with all possible signals.  */
+# if @HAVE_POSIX_SIGNALBLOCKING@
+/* This function is defined as a macro on MacOS X.  */
+#  if defined __cplusplus && defined GNULIB_NAMESPACE
+#   undef sigfillset
+#  endif
+# else
+_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
+_GL_CXXALIASWARN (sigfillset);
+
+/* Return the set of those blocked signals that are pending.  */
+# if !@HAVE_POSIX_SIGNALBLOCKING@
+_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
+_GL_CXXALIASWARN (sigpending);
+
+/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
+   Then, if SET is not NULL, affect the current set of blocked signals by
+   combining it with *SET as indicated in OPERATION.
+   In this implementation, you are not allowed to change a signal handler
+   while the signal is blocked.  */
+# if !@HAVE_POSIX_SIGNALBLOCKING@
+#  define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
+#  define SIG_SETMASK 1  /* blocked_set = *set; */
+#  define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
+_GL_FUNCDECL_SYS (sigprocmask, int,
+                  (int operation, const sigset_t *set, sigset_t *old_set));
+# endif
+_GL_CXXALIAS_SYS (sigprocmask, int,
+                  (int operation, const sigset_t *set, sigset_t *old_set));
+_GL_CXXALIASWARN (sigprocmask);
+
+/* Install the handler FUNC for signal SIG, and return the previous
+   handler.  */
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_function_taking_int_returning_void_t
+typedef void (*_gl_function_taking_int_returning_void_t) (int);
+#  define GNULIB_defined_function_taking_int_returning_void_t 1
+# endif
+# ifdef __cplusplus
+}
+# endif
+# if !@HAVE_POSIX_SIGNALBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define signal rpl_signal
+#  endif
+_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
+                  (int sig, _gl_function_taking_int_returning_void_t func));
+_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
+                  (int sig, _gl_function_taking_int_returning_void_t func));
+# else
+_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
+                  (int sig, _gl_function_taking_int_returning_void_t func));
+# endif
+_GL_CXXALIASWARN (signal);
+
+/* Raise signal SIG.  */
+# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef raise
+#   define raise rpl_raise
+#  endif
+_GL_FUNCDECL_RPL (raise, int, (int sig));
+_GL_CXXALIAS_RPL (raise, int, (int sig));
+# else
+_GL_CXXALIAS_SYS (raise, int, (int sig));
+# endif
+_GL_CXXALIASWARN (raise);
+
+#elif defined GNULIB_POSIXCHECK
+# undef sigaddset
+# if HAVE_RAW_DECL_SIGADDSET
+_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigdelset
+# if HAVE_RAW_DECL_SIGDELSET
+_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigemptyset
+# if HAVE_RAW_DECL_SIGEMPTYSET
+_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigfillset
+# if HAVE_RAW_DECL_SIGFILLSET
+_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigismember
+# if HAVE_RAW_DECL_SIGISMEMBER
+_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigpending
+# if HAVE_RAW_DECL_SIGPENDING
+_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+# undef sigprocmask
+# if HAVE_RAW_DECL_SIGPROCMASK
+_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
+                 "use the gnulib module sigprocmask for portability");
+# endif
+#endif /* @GNULIB_SIGPROCMASK@ */
+
+
+#if @GNULIB_SIGACTION@
+# if !@HAVE_SIGACTION@
+
+#  if !@HAVE_SIGINFO_T@
+
+#   if !GNULIB_defined_siginfo_types
+
+/* Present to allow compilation, but unsupported by gnulib.  */
+union sigval
+{
+  int sival_int;
+  void *sival_ptr;
+};
+
+/* Present to allow compilation, but unsupported by gnulib.  */
+struct siginfo_t
+{
+  int si_signo;
+  int si_code;
+  int si_errno;
+  pid_t si_pid;
+  uid_t si_uid;
+  void *si_addr;
+  int si_status;
+  long si_band;
+  union sigval si_value;
+};
+typedef struct siginfo_t siginfo_t;
+
+#    define GNULIB_defined_siginfo_types 1
+#   endif
+
+#  endif /* !@HAVE_SIGINFO_T@ */
+
+/* We assume that platforms which lack the sigaction() function also lack
+   the 'struct sigaction' type, and vice versa.  */
+
+#  if !GNULIB_defined_struct_sigaction
+
+struct sigaction
+{
+  union
+  {
+    void (*_sa_handler) (int);
+    /* Present to allow compilation, but unsupported by gnulib.  POSIX
+       says that implementations may, but not must, make sa_sigaction
+       overlap with sa_handler, but we know of no implementation where
+       they do not overlap.  */
+    void (*_sa_sigaction) (int, siginfo_t *, void *);
+  } _sa_func;
+  sigset_t sa_mask;
+  /* Not all POSIX flags are supported.  */
+  int sa_flags;
+};
+#   define sa_handler _sa_func._sa_handler
+#   define sa_sigaction _sa_func._sa_sigaction
+/* Unsupported flags are not present.  */
+#   define SA_RESETHAND 1
+#   define SA_NODEFER 2
+#   define SA_RESTART 4
+
+#   define GNULIB_defined_struct_sigaction 1
+#  endif
+
+_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
+                                   struct sigaction *restrict));
+
+# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
+
+#  define sa_sigaction sa_handler
+
+# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
+
+_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
+                                   struct sigaction *restrict));
+_GL_CXXALIASWARN (sigaction);
+
+#elif defined GNULIB_POSIXCHECK
+# undef sigaction
+# if HAVE_RAW_DECL_SIGACTION
+_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
+                 "use the gnulib module sigaction for portability");
+# endif
+#endif
+
+/* Some systems don't have SA_NODEFER.  */
+#ifndef SA_NODEFER
+# define SA_NODEFER 0
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SIGNAL_H */
+#endif /* _@GUARD_PREFIX@_SIGNAL_H */
+#endif

=== modified file 'lib/sys_select.in.h'
--- lib/sys_select.in.h 2011-07-01 06:13:09 +0000
+++ lib/sys_select.in.h 2011-07-06 16:49:44 +0000
@@ -36,12 +36,19 @@
 
 #ifndef _@GUARD_PREFIX@_SYS_SELECT_H
 
+/* On many platforms, <sys/select.h> assumes prior inclusion of
+   <sys/types.h>.  Also, mingw defines sigset_t there, instead of
+   in <signal.h> where it belongs.  */
+#include <sys/types.h>
+
+/* Get definition of 'sigset_t'.
+   But avoid namespace pollution on glibc systems.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <signal.h>
+#endif
+
 #if @HAVE_SYS_SELECT_H@
 
-/* On many platforms, <sys/select.h> assumes prior inclusion of
-   <sys/types.h>.  */
-# include <sys/types.h>
-
 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
    of 'struct timeval', and no definition of this type.
    Also, MacOS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
@@ -77,20 +84,12 @@
 # if defined __hpux
 #  include <string.h>
 # endif
-/* On native Windows platforms:
-   Get the 'fd_set' type.  Also, gnulib's <sys/socket.h> redefines select
-   so as to hide the declaration from <winsock2.h>.  */
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-#  include <sys/socket.h>
+/* On native Windows platforms, get the 'fd_set' type and related macros.  */
+# if @HAVE_WINSOCK2_H@
+#  include <winsock2.h>
 # endif
 #endif
 
-/* Get definition of 'sigset_t'.
-   But avoid namespace pollution on glibc systems.  */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <signal.h>
-#endif
-
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */

=== modified file 'm4/gl-comp.m4'
--- m4/gl-comp.m4       2011-07-01 06:13:09 +0000
+++ m4/gl-comp.m4       2011-07-06 16:49:44 +0000
@@ -58,7 +58,9 @@
   # Code from module mktime:
   # Code from module multiarch:
   # Code from module pselect:
+  # Code from module pthread_sigmask:
   # Code from module readlink:
+  # Code from module signal:
   # Code from module socklen:
   # Code from module ssize_t:
   # Code from module stat:
@@ -165,7 +167,7 @@
 gl_TIME_MODULE_INDICATOR([mktime])
 gl_MULTIARCH
 gl_FUNC_PSELECT
-if test $REPLACE_PSELECT = 1; then
+if test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1; then
   AC_LIBOBJ([pselect])
 fi
 gl_SYS_SELECT_MODULE_INDICATOR([pselect])
@@ -175,6 +177,7 @@
   gl_PREREQ_READLINK
 fi
 gl_UNISTD_MODULE_INDICATOR([readlink])
+gl_SIGNAL_H
 gl_TYPE_SOCKLEN_T
 gt_TYPE_SSIZE_T
 gl_STAT_TIME
@@ -222,6 +225,7 @@
 gl_UTIMENS
   gl_gnulib_enabled_dosname=false
   gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
+  gl_gnulib_enabled_pthread_sigmask=false
   gl_gnulib_enabled_stat=false
   gl_gnulib_enabled_strtoll=false
   gl_gnulib_enabled_strtoull=false
@@ -240,6 +244,17 @@
       gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true
     fi
   }
+  func_gl_gnulib_m4code_pthread_sigmask ()
+  {
+    if ! $gl_gnulib_enabled_pthread_sigmask; then
+gl_PTHREAD_SIGMASK
+gl_SYS_SELECT_MODULE_INDICATOR([pthread_sigmask])
+      gl_gnulib_enabled_pthread_sigmask=true
+      if $condition; then
+        func_gl_gnulib_m4code_sigprocmask
+      fi
+    fi
+  }
   func_gl_gnulib_m4code_stat ()
   {
     if ! $gl_gnulib_enabled_stat; then
@@ -297,6 +312,12 @@
   if test $REPLACE_LSTAT = 1; then
     func_gl_gnulib_m4code_stat
   fi
+  if test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1; then
+    func_gl_gnulib_m4code_pthread_sigmask
+  fi
+  if test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1; then
+    func_gl_gnulib_m4code_select
+  fi
   if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
     func_gl_gnulib_m4code_stat
   fi
@@ -315,6 +336,7 @@
   m4_pattern_allow([^gl_GNULIB_ENABLED_])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], 
[$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
+  AM_CONDITIONAL([gl_GNULIB_ENABLED_pthread_sigmask], 
[$gl_gnulib_enabled_pthread_sigmask])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strtoull])
@@ -501,6 +523,7 @@
   lib/sha256.h
   lib/sha512.c
   lib/sha512.h
+  lib/signal.in.h
   lib/stat-time.h
   lib/stat.c
   lib/stdarg.in.h
@@ -552,10 +575,12 @@
   m4/mktime.m4
   m4/multiarch.m4
   m4/pselect.m4
+  m4/pthread_sigmask.m4
   m4/readlink.m4
   m4/sha1.m4
   m4/sha256.m4
   m4/sha512.m4
+  m4/signal_h.m4
   m4/socklen.m4
   m4/ssize_t.m4
   m4/st_dm_mode.m4

=== modified file 'm4/pselect.m4'
--- m4/pselect.m4       2011-07-01 06:13:09 +0000
+++ m4/pselect.m4       2011-07-06 16:49:44 +0000
@@ -14,15 +14,15 @@
     AC_CACHE_CHECK([whether signature of pselect conforms to POSIX],
       gl_cv_sig_pselect,
       [AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM(
-             [[#include <sys/select.h>
-               ]],
-             [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
-                         struct timespec const *restrict,
-                         sigset_t const *restrict) = pselect;
-               return !p;]])],
-        [gl_cv_sig_pselect=yes],
-        [gl_cv_sig_pselect=no])])
+         [AC_LANG_PROGRAM(
+              [[#include <sys/select.h>
+                ]],
+              [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
+                          struct timespec const *restrict,
+                          sigset_t const *restrict) = pselect;
+                return !p;]])],
+         [gl_cv_sig_pselect=yes],
+         [gl_cv_sig_pselect=no])])
   fi
 
   if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then

=== added file 'm4/pthread_sigmask.m4'
--- m4/pthread_sigmask.m4       1970-01-01 00:00:00 +0000
+++ m4/pthread_sigmask.m4       2011-07-06 16:49:44 +0000
@@ -0,0 +1,24 @@
+# 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
+])

=== added file 'm4/signal_h.m4'
--- m4/signal_h.m4      1970-01-01 00:00:00 +0000
+++ m4/signal_h.m4      2011-07-06 16:49:44 +0000
@@ -0,0 +1,76 @@
+# signal_h.m4 serial 14
+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 with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SIGNAL_H],
+[
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+  AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
+  gl_NEXT_HEADERS([signal.h])
+
+# AIX declares sig_atomic_t to already include volatile, and C89 compilers
+# then choke on 'volatile sig_atomic_t'.  C99 requires that it compile.
+  AC_CHECK_TYPE([volatile sig_atomic_t], [],
+    [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
+#include <signal.h>
+    ]])
+
+  AC_REQUIRE([AC_TYPE_UID_T])
+
+  dnl Persuade glibc <signal.h> to define sighandler_t.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
+#include <signal.h>
+    ]])
+
+  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>
+    ]], [pthread_sigmask sigaction
+    sigaddset sigdelset sigemptyset sigfillset sigismember
+    sigpending sigprocmask])
+])
+
+AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
+[
+  AC_CHECK_TYPES([sigset_t],
+    [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no],
+    [[
+      #include <signal.h>
+      /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
+      #include <sys/types.h>
+    ]])
+  if test $gl_cv_type_sigset_t != yes; then
+    HAVE_SIGSET_T=0
+  fi
+])
+
+AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+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])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
+  HAVE_SIGSET_T=1;             AC_SUBST([HAVE_SIGSET_T])
+  HAVE_SIGINFO_T=1;            AC_SUBST([HAVE_SIGINFO_T])
+  HAVE_SIGACTION=1;            AC_SUBST([HAVE_SIGACTION])
+  HAVE_STRUCT_SIGACTION_SA_SIGACTION=1;
+                               AC_SUBST([HAVE_STRUCT_SIGACTION_SA_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])
+])

=== modified file 'm4/sys_select_h.m4'
--- m4/sys_select_h.m4  2011-07-01 06:13:09 +0000
+++ m4/sys_select_h.m4  2011-07-06 16:49:44 +0000
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 18
+# sys_select_h.m4 serial 19
 dnl Copyright (C) 2006-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,
@@ -64,7 +64,7 @@
 # include <sys/time.h>
 #endif
 #include <sys/select.h>
-    ]], [select])
+    ]], [pselect select])
 ])
 
 AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],







reply via email to

[Prev in Thread] Current Thread [Next in Thread]