From 7f5dc4fe7e3b3a9ce3952a0e49454e2825700a30 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 1 May 2007 19:20:18 +0000 Subject: [PATCH] sigprocmask.h is replaced with . --- ChangeLog | 20 +++++++++++++++ NEWS | 5 ++++ lib/fatal-signal.c | 3 +-- lib/signal_.h | 51 +++++++++++++++++++++++++++++++++++++- lib/sigprocmask.c | 4 +-- lib/sigprocmask.h | 69 ---------------------------------------------------- m4/signal_h.m4 | 5 +++- m4/signalblocking.m4 | 25 ++++++++++--------- modules/signal | 3 +++ modules/sigprocmask | 6 ++--- 10 files changed, 102 insertions(+), 89 deletions(-) delete mode 100644 lib/sigprocmask.h diff --git a/ChangeLog b/ChangeLog index f47e0fb33..a1267f15a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 2007-05-01 Bruno Haible + * lib/sigprocmask.h: Remove file. + * lib/signal_.h: Incorporate the previous contents of sigprocmask.h. + * lib/sigprocmask.c: Include instead of sigprocmask.h. + * m4/signal_h.m4 (gl_SIGNAL_H_DEFAULTS): Substitute GNULIB_SIGPROCMASK, + HAVE_POSIX_SIGNALBLOCKING, HAVE_SIGSET_T. + * m4/signalblocking.m4 (gl_SIGNALBLOCKING): Require + gl_SIGNAL_H_DEFAULTS. Set HAVE_POSIX_SIGNALBLOCKING as a shell variable. + (gl_PREREQ_SIGPROCMASK): Require gl_SIGNAL_H_DEFAULTS. Set + HAVE_SIGSET_T as a shell variable. + * modules/signal (Makefile.am): Substitute GNULIB_SIGPROCMASK, + HAVE_POSIX_SIGNALBLOCKING, HAVE_SIGSET_T into signal.h. + * modules/sigprocmask (Files): Remove lib/sigprocmask.h. + (Depends-on): Add signal. Remove verify. + (configure.ac): Invoke gl_SIGNAL_MODULE_INDICATOR. + (Include): Mention instead of sigprocmask.h. + * NEWS: Mention the change. + * lib/fatal-signal.c: Don't include sigprocmask.h. + +2007-05-01 Bruno Haible + * modules/signal: New file. * lib/signal_.h: New file. * m4/signal_h.m4: New file. diff --git a/NEWS b/NEWS index 35ee0b667..3bf067f97 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,11 @@ User visible incompatible changes Date Modules Changes +2007-05-01 sigprocmask The module now depends on signal, so replace + #include "sigprocmask.h" + with + #include + 2007-04-06 gettext The macro HAVE_LONG_DOUBLE is no longer set. You can replace all its uses with 1, i.e. assume 'long double' as a type exists. diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c index e9c9d0485..3862b7970 100644 --- a/lib/fatal-signal.c +++ b/lib/fatal-signal.c @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify @@ -27,7 +27,6 @@ #include #include -#include "sigprocmask.h" #include "xalloc.h" #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) diff --git a/lib/signal_.h b/lib/signal_.h index b028b475f..685bcaeb9 100644 --- a/lib/signal_.h +++ b/lib/signal_.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2006-2007 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 @@ -38,6 +38,55 @@ extern "C" { #endif +#if !@HAVE_POSIX_SIGNALBLOCKING@ + +/* Mingw defines sigset_t not in , but in . */ +# include + +/* Maximum signal number + 1. */ +# ifndef NSIG +# define NSIG 32 +# endif + +/* This code supports only 32 signals. */ +typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1]; + +/* A set or mask of signals. */ +# if !@HAVE_SIGSET_T@ +typedef unsigned int sigset_t; +# endif + +/* Test whether a given signal is contained in a signal set. */ +extern int sigismember (const sigset_t *set, int sig); + +/* Initialize a signal set to the empty set. */ +extern int sigemptyset (sigset_t *set); + +/* Add a signal to a signal set. */ +extern int sigaddset (sigset_t *set, int sig); + +/* Remove a signal from a signal set. */ +extern int sigdelset (sigset_t *set, int sig); + +/* Fill a signal set with all possible signals. */ +extern int sigfillset (sigset_t *set); + +/* Return the set of those blocked signals that are pending. */ +extern int sigpending (sigset_t *set); + +/* 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. */ +# 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; */ +extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set); + +#endif + + #ifdef __cplusplus } #endif diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c index c38c7e32f..9649f8b82 100644 --- a/lib/sigprocmask.c +++ b/lib/sigprocmask.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ #include /* Specification. */ -#include "sigprocmask.h" +#include #include #include diff --git a/lib/sigprocmask.h b/lib/sigprocmask.h deleted file mode 100644 index d31c365a3..000000000 --- a/lib/sigprocmask.h +++ /dev/null @@ -1,69 +0,0 @@ -/* POSIX compatible signal blocking. - Copyright (C) 2006 Free Software Foundation, Inc. - Written by Bruno Haible , 2006. - - 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 2, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include - -#if ! HAVE_POSIX_SIGNALBLOCKING - -/* Mingw defines sigset_t not in , but in . */ -# include - -# include "verify.h" - -/* Maximum signal number + 1. */ -# ifndef NSIG -# define NSIG 32 -# endif - -/* This code supports only 32 signals. */ -verify (NSIG <= 32); - -/* A set or mask of signals. */ -# if !HAVE_SIGSET_T -typedef unsigned int sigset_t; -# endif - -/* Test whether a given signal is contained in a signal set. */ -extern int sigismember (const sigset_t *set, int sig); - -/* Initialize a signal set to the empty set. */ -extern int sigemptyset (sigset_t *set); - -/* Add a signal to a signal set. */ -extern int sigaddset (sigset_t *set, int sig); - -/* Remove a signal from a signal set. */ -extern int sigdelset (sigset_t *set, int sig); - -/* Fill a signal set with all possible signals. */ -extern int sigfillset (sigset_t *set); - -/* Return the set of those blocked signals that are pending. */ -extern int sigpending (sigset_t *set); - -/* 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. */ -# 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; */ -extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set); - -#endif diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 4ac1e402a..c9b40ca19 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 1 +# signal_h.m4 serial 2 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,5 +21,8 @@ AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], AC_DEFUN([gl_SIGNAL_H_DEFAULTS], [ + GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) 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]) ]) diff --git a/m4/signalblocking.m4 b/m4/signalblocking.m4 index 2c03df49e..99a0d5475 100644 --- a/m4/signalblocking.m4 +++ b/m4/signalblocking.m4 @@ -1,5 +1,5 @@ -# signalblocking.m4 serial 4 -dnl Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. +# signalblocking.m4 serial 5 +dnl Copyright (C) 2001-2002, 2006-2007 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. @@ -11,30 +11,33 @@ dnl with or without modifications, as long as this notice is preserved. # For simplicity, here we check only for the POSIX signal blocking. AC_DEFUN([gl_SIGNALBLOCKING], [ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) signals_not_posix= AC_EGREP_HEADER(sigset_t, signal.h, , signals_not_posix=1) if test -z "$signals_not_posix"; then AC_CHECK_FUNC(sigprocmask, [gl_cv_func_sigprocmask=1]) fi - if test -n "$gl_cv_func_sigprocmask"; then - AC_DEFINE([HAVE_POSIX_SIGNALBLOCKING], 1, - [Define to 1 if you have the sigset_t type and the sigprocmask function.]) - else + if test -z "$gl_cv_func_sigprocmask"; then + HAVE_POSIX_SIGNALBLOCKING=0 AC_LIBOBJ([sigprocmask]) gl_PREREQ_SIGPROCMASK fi ]) -# Prerequisites of lib/sigprocmask.h and lib/sigprocmask.c. -AC_DEFUN([gl_PREREQ_SIGPROCMASK], [ +# Prerequisites of the part of lib/signal_.h and of lib/sigprocmask.c. +AC_DEFUN([gl_PREREQ_SIGPROCMASK], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_CHECK_TYPES([sigset_t], [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], [#include /* Mingw defines sigset_t not in , but in . */ #include ]) - if test $gl_cv_type_sigset_t = yes; then - AC_DEFINE([HAVE_SIGSET_T], [1], - [Define to 1 if you lack the sigprocmask function but have the sigset_t type.]) + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 fi + dnl HAVE_SIGSET_T is 1 if the system lacks the sigprocmask function but has + dnl the sigset_t type. + AC_SUBST([HAVE_SIGSET_T]) AC_CHECK_FUNCS_ONCE(raise) ]) diff --git a/modules/signal b/modules/signal index 567327804..c139af596 100644 --- a/modules/signal +++ b/modules/signal @@ -21,6 +21,9 @@ signal.h: signal_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''ABSOLUTE_SIGNAL_H''@|$(ABSOLUTE_SIGNAL_H)|g' \ + -e 's|@''GNULIB_SIGPROCMASK''@|$(GNULIB_SIGPROCMASK)|g' \ + -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ + -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/signal_.h; \ } > $@-t diff --git a/modules/sigprocmask b/modules/sigprocmask index 314e4be45..49e4fbbaf 100644 --- a/modules/sigprocmask +++ b/modules/sigprocmask @@ -2,21 +2,21 @@ Description: POSIX compatible signal blocking. Files: -lib/sigprocmask.h lib/sigprocmask.c m4/signalblocking.m4 Depends-on: -verify +signal stdint configure.ac: gl_SIGNALBLOCKING +gl_SIGNAL_MODULE_INDICATOR([sigprocmask]) Makefile.am: Include: -"sigprocmask.h" + License: LGPL -- 2.11.0