bug-gnulib
[Top][All Lists]
Advanced

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

Re: sigaction, SA_SIGINFO, and SIG_IGN


From: Paul Eggert
Subject: Re: sigaction, SA_SIGINFO, and SIG_IGN
Date: Fri, 20 Jun 2008 11:41:13 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Bruno Haible <address@hidden> writes:

> This will not compile on Interix 3.5, whereas the current code does.

True; how about working around that problem by inserting the following
prelude into fatal-signal.c:

   typedef void (*sa_handler_t) (int);

   /* Return the handler of a signal, as a sa_handler_t value regardless
      of its true type.  The resulting function can be compared to
      special values like SIG_IGN but it is not portable to call it.  */
   static sa_handler_t
   get_handler (struct sigaction const *a)
   {
   #ifdef SA_SIGINFO
     /* POSIX says that special values like SIG_IGN can only occur
        when action.sa_flags does not contain SA_SIGINFO.  But in
        Linux 2.4, for example, sa_sigaction and sa_handler are
        aliases and a signal is ignored if sa_sigaction (after
        casting) equals SIG_IGN.  So use (and cast) sa_sigaction in
        that case.  */
     if (a->sa_flags & SA_SIGINFO)
       return (sa_handler_t) a->sa_sigaction;
   #endif
     return a->sa_handler;
   }

and then using the following code in init_fatal_signals?

  if (sigaction (fatal_signals[i], NULL, &action) == 0
      && get_handler (&action) == SIG_IGN)
    fatal_signals[i] = -1;




reply via email to

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