From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#9000: Update time patch for Frandom, pthread_sigmask, etc. Date: Wed, 06 Jul 2011 10:00:13 -0700 Organization: UCLA Computer Science Department Message-ID: <4E14949D.6030200@cs.ucla.edu> References: <4E12B5BE.6070903@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1309976505 23162 80.91.229.12 (6 Jul 2011 18:21:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 6 Jul 2011 18:21:45 +0000 (UTC) To: 9000@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 06 20:21:39 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QeWjB-0004Yc-MY for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Jul 2011 20:21:38 +0200 Original-Received: from localhost ([::1]:34852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QeWjA-0007zG-Ff for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Jul 2011 14:21:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:56242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QeVTH-0003Fx-03 for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2011 13:01:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QeVTD-0004Wa-Jp for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2011 13:01:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QeVTC-0004WO-Om for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2011 13:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QeVTC-0005Uq-8i; Wed, 06 Jul 2011 13:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Jul 2011 17:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9000 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9000-submit@debbugs.gnu.org id=B9000.130997162819774 (code B ref 9000); Wed, 06 Jul 2011 17:01:02 +0000 Original-Received: (at 9000) by debbugs.gnu.org; 6 Jul 2011 17:00:28 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QeVSc-00058t-4o for submit@debbugs.gnu.org; Wed, 06 Jul 2011 13:00:27 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QeVSX-0004wC-Em for 9000@debbugs.gnu.org; Wed, 06 Jul 2011 13:00:24 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 0AC7039E8118; Wed, 6 Jul 2011 10:00:16 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id evyXuFviZlpu; Wed, 6 Jul 2011 10:00:13 -0700 (PDT) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 4FEE639E80F8; Wed, 6 Jul 2011 10:00:13 -0700 (PDT) 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 In-Reply-To: <4E12B5BE.6070903@cs.ucla.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 06 Jul 2011 13:01:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:48091 Archived-At: 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. =3D=3D=3D 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) !=3D 0) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D * Makefile.in (GNULIB_TOOL_FLAGS): Add --avoid=3Dselect --avoid=3Dsigproc= mask. 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. =3D=3D=3D 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 =3D \ + --avoid=3Dselect --avoid=3Dsigprocmask \ --conditional-dependencies --import --no-changelog --no-vc-files \ --makefile-name=3Dgnulib.mk sync-from-gnulib: $(gnulib_srcdir) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =3D=3D=3D 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 =3D=3D=3D 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. =20 2011-07-05 Jan Dj=C3=A4rv =20 =3D=3D=3D 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=3D. --lib=3Dlibgnu --source-b= ase=3Dlib --m4-base=3Dm4 --doc-base=3Ddoc --tests-base=3Dtests --aux-dir=3D= . --makefile-name=3Dgnulib.mk --conditional-dependencies --no-libtool --m= acro-prefix=3Dgl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/= sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloa= davg getopt-gnu gettime gettimeofday ignore-value intprops lstat mktime p= select readlink socklen stat-time stdarg stdio strftime strtoimax strtoum= ax symlink sys_stat sys_time time timespec-add timespec-sub utimens +# Reproduce by: gnulib-tool --import --dir=3D. --lib=3Dlibgnu --source-b= ase=3Dlib --m4-base=3Dm4 --doc-base=3Ddoc --tests-base=3Dtests --aux-dir=3D= . --avoid=3Dselect --avoid=3Dsigprocmask --makefile-name=3Dgnulib.mk --co= nditional-dependencies --no-libtool --macro-prefix=3Dgl --no-vc-files all= oca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 d= toastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofd= ay 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 =20 =20 MOSTLYCLEANFILES +=3D core *.stackdump @@ -367,6 +367,44 @@ =20 ## end gnulib module readlink =20 +## begin gnulib module signal + +BUILT_SOURCES +=3D signal.h + +# We need the following in order to create when the system +# doesn't have a complete one. +signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_N= ONNULL_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_SIGA= CTION_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 +=3D signal.h signal.h-t + +EXTRA_DIST +=3D signal.in.h + +## end gnulib module signal + ## begin gnulib module stat =20 if gl_GNULIB_ENABLED_stat =3D=3D=3D 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 #include =20 -#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. */ =20 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); =20 select_result =3D select (nfds, rfds, wfds, xfds, tvp); =20 if (sigmask) { int select_errno =3D errno; - sigprocmask (SIG_SETMASK, &origmask, NULL); + pthread_sigmask (SIG_SETMASK, &origmask, NULL); errno =3D select_errno; } =20 =3D=3D=3D 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 . + + 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 .= */ + +#if __GNUC__ >=3D 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 , but in . + On Solaris 10, includes , which eventually in= cludes + us; so include now, before the second inclusion guard. = */ +#include + +/* 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 'sigprocmas= k', + '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 <=3D 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 *OL= D_SET. + Then, if SET is not NULL, affect the current set of blocked signals b= y + combining it with *SET as indicated in OPERATION. + In this implementation, you are not allowed to change a signal handle= r + while the signal is blocked. */ +# if !@HAVE_POSIX_SIGNALBLOCKING@ +# define SIG_BLOCK 0 /* blocked_set =3D blocked_set | *set; */ +# define SIG_SETMASK 1 /* blocked_set =3D *set; */ +# define SIG_UNBLOCK 2 /* blocked_set =3D 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 fun= c)); +_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t, + (int sig, _gl_function_taking_int_returning_void_t fun= c)); +# else +_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, + (int sig, _gl_function_taking_int_returning_void_t fun= c)); +# 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 lac= k + 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 =3D=3D=3D 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 @@ =20 #ifndef _@GUARD_PREFIX@_SYS_SELECT_H =20 +/* On many platforms, assumes prior inclusion of + . Also, mingw defines sigset_t there, instead of + in where it belongs. */ +#include + +/* Get definition of 'sigset_t'. + But avoid namespace pollution on glibc systems. */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include +#endif + #if @HAVE_SYS_SELECT_H@ =20 -/* On many platforms, assumes prior inclusion of - . */ -# include - /* On OSF/1 4.0, 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 # endif -/* On native Windows platforms: - Get the 'fd_set' type. Also, gnulib's redefines selec= t - so as to hide the declaration from . */ -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# include +/* On native Windows platforms, get the 'fd_set' type and related macros= . */ +# if @HAVE_WINSOCK2_H@ +# include # endif #endif =20 -/* Get definition of 'sigset_t'. - But avoid namespace pollution on glibc systems. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include -#endif - /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ =20 /* The definition of _GL_WARN_ON_USE is copied here. */ =3D=3D=3D 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 =3D 1; then +if test $HAVE_PSELECT =3D 0 || test $REPLACE_PSELECT =3D 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=3Dfalse gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=3Dfalse + gl_gnulib_enabled_pthread_sigmask=3Dfalse gl_gnulib_enabled_stat=3Dfalse gl_gnulib_enabled_strtoll=3Dfalse gl_gnulib_enabled_strtoull=3Dfalse @@ -240,6 +244,17 @@ gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=3Dtrue 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=3Dtrue + 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 =3D 1; then func_gl_gnulib_m4code_stat fi + if test $HAVE_PSELECT =3D 0 || test $REPLACE_PSELECT =3D 1; then + func_gl_gnulib_m4code_pthread_sigmask + fi + if test $HAVE_PSELECT =3D 0 || test $REPLACE_PSELECT =3D 1; then + func_gl_gnulib_m4code_select + fi if test $HAVE_READLINK =3D 0 || test $REPLACE_READLINK =3D 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_dosnam= e]) AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [= $gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_pthread_sigmask], [$gl_gnulib_enable= d_pthread_sigmask]) AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat]) AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtol= l]) AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strto= ull]) @@ -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 =3D=3D=3D 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 - ]], - [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict, - struct timespec const *restrict, - sigset_t const *restrict) =3D pselect; - return !p;]])], - [gl_cv_sig_pselect=3Dyes], - [gl_cv_sig_pselect=3Dno])]) + [AC_LANG_PROGRAM( + [[#include + ]], + [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict, + struct timespec const *restrict, + sigset_t const *restrict) =3D pselect; + return !p;]])], + [gl_cv_sig_pselect=3Dyes], + [gl_cv_sig_pselect=3Dno])]) fi =20 if test $ac_cv_func_pselect =3D no || test $gl_cv_sig_pselect =3D no; = then =3D=3D=3D 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" =3D posix; then + gl_save_LIBS=3D"$LIBS" + LIBS=3D"$LIBS $LIBMULTITHREAD" + AC_CHECK_FUNCS([pthread_sigmask]) + LIBS=3D"$gl_save_LIBS" + fi + ], [ + AC_CHECK_FUNCS_ONCE([pthread_sigmask]) + ]) + + if test $ac_cv_func_pthread_sigmask =3D no; then + REPLACE_PTHREAD_SIGMASK=3D0 + fi +]) =3D=3D=3D 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 compile= rs +# 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=3D0], [[ +#include + ]]) + + AC_REQUIRE([AC_TYPE_UID_T]) + + dnl Persuade glibc to define sighandler_t. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=3D0], [[ +#include + ]]) + + 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 + ]], [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=3Dyes], [gl_cv_type_sigset_t=3Dno], + [[ + #include + /* Mingw defines sigset_t not in , but in .= */ + #include + ]]) + if test $gl_cv_type_sigset_t !=3D yes; then + HAVE_SIGSET_T=3D0 + fi +]) + +AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded onc= e 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=3D0; AC_SUBST([GNULIB_PTHREAD_SIGMASK]) + GNULIB_SIGNAL_H_SIGPIPE=3D0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE]) + GNULIB_SIGPROCMASK=3D0; AC_SUBST([GNULIB_SIGPROCMASK]) + GNULIB_SIGACTION=3D0; AC_SUBST([GNULIB_SIGACTION]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_POSIX_SIGNALBLOCKING=3D1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) + HAVE_SIGSET_T=3D1; AC_SUBST([HAVE_SIGSET_T]) + HAVE_SIGINFO_T=3D1; AC_SUBST([HAVE_SIGINFO_T]) + HAVE_SIGACTION=3D1; AC_SUBST([HAVE_SIGACTION]) + HAVE_STRUCT_SIGACTION_SA_SIGACTION=3D1; + AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACT= ION]) + HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=3D1; + AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T= ]) + HAVE_SIGHANDLER_T=3D1; AC_SUBST([HAVE_SIGHANDLER_T]) + REPLACE_PTHREAD_SIGMASK=3D0; AC_SUBST([REPLACE_PTHREAD_SIGMASK]) +]) =3D=3D=3D 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 #endif #include - ]], [select]) + ]], [pselect select]) ]) =20 AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],