cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/lib ChangeLog sighandle.c system.h


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/lib ChangeLog sighandle.c system.h
Date: Tue, 16 Sep 2008 14:56:04 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     08/09/16 14:56:04

Modified files:
        lib            : ChangeLog sighandle.c system.h 

Log message:
        * lib/system.h: Remove signal detection.
        * lib/sighandle.c: Assume POSIX signal semantics via GNULIB.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/ChangeLog?cvsroot=cvs&r1=1.561&r2=1.562
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/sighandle.c?cvsroot=cvs&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/ccvs/lib/system.h?cvsroot=cvs&r1=1.88&r2=1.89

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/ChangeLog,v
retrieving revision 1.561
retrieving revision 1.562
diff -u -b -r1.561 -r1.562
--- ChangeLog   15 Sep 2008 21:53:06 -0000      1.561
+++ ChangeLog   16 Sep 2008 14:56:04 -0000      1.562
@@ -1,3 +1,8 @@
+2008-09-16  Derek Price  <address@hidden>
+
+       * lib/system.h: Remove signal detection.
+       * lib/sighandle.c: Assume POSIX signal semantics via GNULIB.
+
 2008-09-15  Derek Price  <address@hidden>
 
        * .cvsignore: Ignore generated files.

Index: sighandle.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/sighandle.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- sighandle.c 5 Oct 2003 03:49:29 -0000       1.11
+++ sighandle.c 16 Sep 2008 14:56:04 -0000      1.12
@@ -69,23 +69,11 @@
 
 /* Define array of default signal vectors */
 
-#ifdef POSIX_SIGNALS
 static struct sigaction        *SIG_defaults;
-#else
-#ifdef BSD_SIGNALS
-static struct sigvec           *SIG_defaults;
-#else
-static RETSIGTYPE              (**SIG_defaults) (int);
-#endif
-#endif
 
 /* Critical section housekeeping */
 static int             SIG_crSectNest = 0;     /* Nesting level */
-#ifdef POSIX_SIGNALS
 static sigset_t        SIG_crSectMask;         /* Signal mask */
-#else
-static int             SIG_crSectMask;         /* Signal mask */
-#endif
 
 /*
  * Initialize the signal handler arrays
@@ -94,14 +82,11 @@
 static int SIG_init()
 {
        int i;
-#ifdef POSIX_SIGNALS
        sigset_t sigset_test;
-#endif
 
        if (SIG_defaults && SIG_handlers)       /* already allocated */
                return (0);
 
-#ifdef POSIX_SIGNALS
        (void) sigfillset(&sigset_test);
        for (i = 1; i < SIGMAX && sigismember(&sigset_test, i) == 1; i++)
                ;
@@ -112,19 +97,6 @@
                SIG_defaults = (struct sigaction *)
                        calloc(i, sizeof(struct sigaction));
        (void) sigemptyset(&SIG_crSectMask);
-#else
-       i = SIGMAX+1;
-#ifdef BSD_SIGNALS
-       if (!SIG_defaults)
-               SIG_defaults = (struct sigvec *)
-                       calloc(i, sizeof(struct sigvec));
-#else
-       if (!SIG_defaults)
-               SIG_defaults = ( RETSIGTYPE (**) (int) )
-                       calloc( i, sizeof( RETSIGTYPE (**) (int) ) );
-#endif
-       SIG_crSectMask = 0;
-#endif
        if (!SIG_handlers)
                SIG_handlers = (struct SIG_hlist **)
                        calloc(i, sizeof(struct SIG_hlist *));
@@ -142,19 +114,11 @@
        {
                if (SIG_crSectNest == 0)
                {
-#ifdef POSIX_SIGNALS
                        sigset_t sigset_mask;
 
                        (void) sigfillset(&sigset_mask);
                        (void) sigprocmask(SIG_SETMASK,
                                           &sigset_mask, &SIG_crSectMask);
-#else
-#ifdef BSD_SIGNALS
-                       SIG_crSectMask = sigblock(~0);
-#else
-                       /* TBD */
-#endif
-#endif
                }
                SIG_crSectNest++;
        }
@@ -171,17 +135,7 @@
        {
                SIG_crSectNest--;
                if (SIG_crSectNest == 0)
-               {
-#ifdef POSIX_SIGNALS
                        (void) sigprocmask(SIG_SETMASK, &SIG_crSectMask, NULL);
-#else
-#ifdef BSD_SIGNALS
-                       (void) sigsetmask(SIG_crSectMask);
-#else
-                       /* TBD */
-#endif
-#endif
-               }
        }
 }
 
@@ -224,15 +178,8 @@
 {
        int                     val;
        struct SIG_hlist        *this;
-#ifdef POSIX_SIGNALS
        struct sigaction        act;
        sigset_t                sigset_mask, sigset_omask;
-#else
-#ifdef BSD_SIGNALS
-       struct sigvec           vec;
-       int                     mask;
-#endif
-#endif
 
        /* Initialize */
        if (SIG_init() != 0)
@@ -240,15 +187,9 @@
        val = 0;
 
        /* Block this signal while we look at handler chain */
-#ifdef POSIX_SIGNALS
        (void) sigemptyset(&sigset_mask);
        (void) sigaddset(&sigset_mask, sig);
        (void) sigprocmask(SIG_BLOCK, &sigset_mask, &sigset_omask);
-#else
-#ifdef BSD_SIGNALS
-       mask = sigblock(sigmask(sig));
-#endif
-#endif
 
        /* See if this handler was already registered */
        this = SIG_handlers[sig];
@@ -269,21 +210,10 @@
 
                if (SIG_handlers[sig] == (struct SIG_hlist *) NULL)
                {
-#ifdef POSIX_SIGNALS
                        act.sa_handler = SIG_handle;
                        (void) sigemptyset(&act.sa_mask);
                        act.sa_flags = 0;
                        val = sigaction(sig, &act, &SIG_defaults[sig]);
-#else
-#ifdef BSD_SIGNALS
-                       memset (&vec, 0, sizeof (vec));
-                       vec.sv_handler = SIG_handle;
-                       val = sigvec(sig, &vec, &SIG_defaults[sig]);
-#else
-                       if ((SIG_defaults[sig] = signal(sig, SIG_handle)) == 
SIG_ERR)
-                               val = -1;
-#endif
-#endif
                }
 
                /* If not, register it */
@@ -305,13 +235,7 @@
        }
 
        /* Unblock the signal */
-#ifdef POSIX_SIGNALS
        (void) sigprocmask(SIG_SETMASK, &sigset_omask, NULL);
-#else
-#ifdef BSD_SIGNALS
-       (void) sigsetmask(mask);
-#endif
-#endif
 
        return val;
 }
@@ -328,13 +252,7 @@
        int                     val;
        struct SIG_hlist        *this;
        struct SIG_hlist        *last;
-#ifdef POSIX_SIGNALS
        sigset_t                sigset_mask, sigset_omask;
-#else
-#ifdef BSD_SIGNALS
-       int                     mask;
-#endif
-#endif
 
        /* Initialize */
        if (SIG_init() != 0)
@@ -343,15 +261,9 @@
        last = (struct SIG_hlist *) NULL;
 
        /* Block this signal while we look at handler chain */
-#ifdef POSIX_SIGNALS
        (void) sigemptyset(&sigset_mask);
        (void) sigaddset(&sigset_mask, sig);
        (void) sigprocmask(SIG_BLOCK, &sigset_mask, &sigset_omask);
-#else
-#ifdef BSD_SIGNALS
-       mask = sigblock(sigmask(sig));
-#endif
-#endif
 
        /* Search for the signal handler */
        this = SIG_handlers[sig];
@@ -377,28 +289,11 @@
 
        /* Restore default behavior if there are no registered handlers */
        if (SIG_handlers[sig] == (struct SIG_hlist *) NULL)
-       {
-#ifdef POSIX_SIGNALS
                val = sigaction(sig, &SIG_defaults[sig],
                                (struct sigaction *) NULL);
-#else
-#ifdef BSD_SIGNALS
-               val = sigvec(sig, &SIG_defaults[sig], (struct sigvec *) NULL);
-#else
-               if (signal(sig, SIG_defaults[sig]) == SIG_ERR)
-                       val = -1;
-#endif
-#endif
-       }
 
        /* Unblock the signal */
-#ifdef POSIX_SIGNALS
        (void) sigprocmask(SIG_SETMASK, &sigset_omask, NULL);
-#else
-#ifdef BSD_SIGNALS
-       (void) sigsetmask(mask);
-#endif
-#endif
 
        return val;
 }

Index: system.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/lib/system.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- system.h    15 Sep 2008 21:48:03 -0000      1.88
+++ system.h    16 Sep 2008 14:56:04 -0000      1.89
@@ -26,7 +26,6 @@
 #include <assert.h>
 #include <ctype.h>
 #include <errno.h>
-#include <signal.h>
 #include <stdio.h>
 
 /* A GNULIB wrapper for these C89 headers is supplied to solve problems in
@@ -128,23 +127,6 @@
 #  endif
 #endif
 
-/* check for POSIX signals */
-#if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK)
-# define POSIX_SIGNALS
-#endif
-
-/* MINIX 1.6 doesn't properly support sigaction */
-#if defined(_MINIX)
-# undef POSIX_SIGNALS
-#endif
-
-/* If !POSIX, try for BSD.. Reason: 4.4BSD implements these as wrappers */
-#if !defined(POSIX_SIGNALS)
-# if defined(HAVE_SIGVEC) && defined(HAVE_SIGSETMASK) && defined(HAVE_SIGBLOCK)
-#  define BSD_SIGNALS
-# endif
-#endif
-
 /* Under OS/2, this must be included _after_ stdio.h; that's why we do
    it here. */
 #ifdef USE_OWN_TCPIP_H




reply via email to

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