bug-gnulib
[Top][All Lists]
Advanced

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

drop sigprocmask.h, use signal.h instead


From: Bruno Haible
Subject: drop sigprocmask.h, use signal.h instead
Date: Tue, 1 May 2007 21:22:32 +0200
User-agent: KMail/1.5.4

This replaces the sigprocmask.h (gnulib specific include file) with <signal.h>,
using the well-known idioms.

2007-05-01  Bruno Haible  <address@hidden>

        * 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.

*** NEWS        6 Apr 2007 14:36:56 -0000       1.14
--- NEWS        1 May 2007 19:12:46 -0000
***************
*** 6,11 ****
--- 6,16 ----
  
  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.
*** lib/signal_.h       1 May 2007 18:49:26 -0000       1.1
--- lib/signal_.h       1 May 2007 19:12:46 -0000
***************
*** 1,6 ****
  /* A GNU-like <signal.h>.
  
!    Copyright (C) 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
--- 1,6 ----
  /* A GNU-like <signal.h>.
  
!    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,43 ****
--- 38,92 ----
  #endif
  
  
+ #if address@hidden@
+ 
+ /* 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 address@hidden@
+ 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
*** lib/sigprocmask.c   17 Oct 2006 15:27:33 -0000      1.2
--- lib/sigprocmask.c   1 May 2007 19:12:46 -0000
***************
*** 1,5 ****
  /* POSIX compatible signal blocking.
!    Copyright (C) 2006 Free Software Foundation, Inc.
     Written by Bruno Haible <address@hidden>, 2006.
  
     This program is free software; you can redistribute it and/or modify
--- 1,5 ----
  /* POSIX compatible signal blocking.
!    Copyright (C) 2006-2007 Free Software Foundation, Inc.
     Written by Bruno Haible <address@hidden>, 2006.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 19,25 ****
  #include <config.h>
  
  /* Specification.  */
! #include "sigprocmask.h"
  
  #include <errno.h>
  #include <stdint.h>
--- 19,25 ----
  #include <config.h>
  
  /* Specification.  */
! #include <signal.h>
  
  #include <errno.h>
  #include <stdint.h>
*** lib/fatal-signal.c  6 Nov 2006 13:03:10 -0000       1.13
--- lib/fatal-signal.c  1 May 2007 19:12:46 -0000
***************
*** 1,5 ****
  /* Emergency actions in case of a fatal signal.
!    Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc.
     Written by Bruno Haible <address@hidden>, 2003.
  
     This program is free software; you can redistribute it and/or modify
--- 1,5 ----
  /* Emergency actions in case of a fatal signal.
!    Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc.
     Written by Bruno Haible <address@hidden>, 2003.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 27,33 ****
  #include <signal.h>
  #include <unistd.h>
  
- #include "sigprocmask.h"
  #include "xalloc.h"
  
  #define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
--- 27,32 ----
*** m4/signalblocking.m4        27 Oct 2006 14:06:54 -0000      1.6
--- m4/signalblocking.m4        1 May 2007 19:12:46 -0000
***************
*** 1,5 ****
! # signalblocking.m4 serial 4
! dnl Copyright (C) 2001-2002, 2006 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.
--- 1,5 ----
! # 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,40 ****
  # For simplicity, here we check only for the POSIX signal blocking.
  AC_DEFUN([gl_SIGNALBLOCKING],
  [
    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
      AC_LIBOBJ([sigprocmask])
      gl_PREREQ_SIGPROCMASK
    fi
  ])
  
! # Prerequisites of lib/sigprocmask.h and lib/sigprocmask.c.
! AC_DEFUN([gl_PREREQ_SIGPROCMASK], [
    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.])
    fi
    AC_CHECK_FUNCS_ONCE(raise)
  ])
--- 11,43 ----
  # 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 -z "$gl_cv_func_sigprocmask"; then
!     HAVE_POSIX_SIGNALBLOCKING=0
      AC_LIBOBJ([sigprocmask])
      gl_PREREQ_SIGPROCMASK
    fi
  ])
  
! # 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
!     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)
  ])
*** m4/signal_h.m4      1 May 2007 18:49:26 -0000       1.1
--- m4/signal_h.m4      1 May 2007 19:12:46 -0000
***************
*** 1,4 ****
! # signal_h.m4 serial 1
  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,
--- 1,4 ----
! # 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,25 ****
--- 21,28 ----
  
  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])
  ])
*** modules/sigprocmask 16 Oct 2006 11:55:35 -0000      1.1
--- modules/sigprocmask 1 May 2007 19:12:46 -0000
***************
*** 2,22 ****
  POSIX compatible signal blocking.
  
  Files:
- lib/sigprocmask.h
  lib/sigprocmask.c
  m4/signalblocking.m4
  
  Depends-on:
! verify
  stdint
  
  configure.ac:
  gl_SIGNALBLOCKING
  
  Makefile.am:
  
  Include:
! "sigprocmask.h"
  
  License:
  LGPL
--- 2,22 ----
  POSIX compatible signal blocking.
  
  Files:
  lib/sigprocmask.c
  m4/signalblocking.m4
  
  Depends-on:
! signal
  stdint
  
  configure.ac:
  gl_SIGNALBLOCKING
+ gl_SIGNAL_MODULE_INDICATOR([sigprocmask])
  
  Makefile.am:
  
  Include:
! <signal.h>
  
  License:
  LGPL
*** modules/signal      1 May 2007 18:49:26 -0000       1.1
--- modules/signal      1 May 2007 19:12:46 -0000
***************
*** 21,26 ****
--- 21,29 ----
        rm -f address@hidden $@
        { 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; \
        } > address@hidden





reply via email to

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