Commit 7f5dc4fe authored by Bruno Haible's avatar Bruno Haible

sigprocmask.h is replaced with <signal.h>.

parent 5ff2244e
2007-05-01 Bruno Haible <bruno@clisp.org>
* lib/sigprocmask.h: Remove file.
* lib/signal_.h: Incorporate the previous contents of sigprocmask.h.
* lib/sigprocmask.c: Include <signal.h> 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 <signal.h> instead of sigprocmask.h.
* NEWS: Mention the change.
* lib/fatal-signal.c: Don't include sigprocmask.h.
2007-05-01 Bruno Haible <bruno@clisp.org>
* modules/signal: New file.
......@@ -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 <signal.h>
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.
......
/* 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 <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
......@@ -27,7 +27,6 @@
#include <signal.h>
#include <unistd.h>
#include "sigprocmask.h"
#include "xalloc.h"
#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
......
/* A GNU-like <signal.h>.
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 <signal.h>, but in <sys/types.h>. */
# include <sys/types.h>
/* 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
......
/* POSIX compatible signal blocking.
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006-2007 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software; you can redistribute it and/or modify
......@@ -19,7 +19,7 @@
#include <config.h>
/* Specification. */
#include "sigprocmask.h"
#include <signal.h>
#include <errno.h>
#include <stdint.h>
......
/* POSIX compatible signal blocking.
Copyright (C) 2006 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 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 <signal.h>
#if ! HAVE_POSIX_SIGNALBLOCKING
/* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
# include <sys/types.h>
# 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
# 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])
])
# 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 <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
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)
])
......@@ -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
......
......@@ -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"
<signal.h>
License:
LGPL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment