On Wed, Jul 20, 2005 at 02:40:54PM +0300, Jarkko Hietaniemi wrote:
> My (?:m(?:is)?)?adventures in the world of POSIX signals continue.
> 
> Now to followup on my own patch of two years ago [1], here is support
> for SA_SIGINFO (see man sigaction), which allows additional information
> to be passed on to the signal handlers (beyond the signal number).
> 
> I am not entirely proud of the argument passing scheme to the signal
> handler (the name of the signal, a hash ref with the POSIX/SUSv3 fields
> unpacked, and the binary blob of the whole siginfo struct) but I tried
> to find a solution somewhere between being a POSIX purist and a portable
> pragmatist.
> 

Unfortunately, it looks like this patch causes some compile failures on 
BSD-related systems, including Cygwin.  The failure occue in mg.c with the 
following error...

mg.c: In function `Perl_sighandler':
mg.c:2720: error: union has no member named `_file'
*** Error code 1

Below is the code in question.

   2698 #if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
   2699     {
   2700          struct sigaction oact;
   2701
   2702          if (sigaction(sig, 0, &oact) == 0 && oact.sa_flags & 
SA_SIGINFO) {
   2703               siginfo_t *sip;
   2704               va_list args;
   2705
   2706               va_start(args, sig);
   2707               sip = (siginfo_t*)va_arg(args, siginfo_t*);
   2708               if (sip) {
   2709                    HV *sih = newHV();
   2710                    SV *rv  = newRV_noinc((SV*)sih);
   2711                    /* The siginfo fields signo, code, errno, pid, uid,
   2712                     * addr, status, and band are defined by 
POSIX/SUSv3. */
   2713                    hv_store(sih, "signo",   5, newSViv(sip->si_signo),  
0);
   2714                    hv_store(sih, "code",    4, newSViv(sip->si_code),   
0);
   2715                    hv_store(sih, "errno",   5, newSViv(sip->si_errno),  
0);
   2716                    hv_store(sih, "uid",     3, newSViv(sip->si_uid),    
0);
   2717                    hv_store(sih, "pid",     3, newSViv(sip->si_pid),    
0);
   2718                    hv_store(sih, "addr",    4, 
newSVuv(PTR2UV(sip->si_addr)),   0);
   2719                    hv_store(sih, "status",  6, newSViv(sip->si_status), 
0);
   2720                    hv_store(sih, "band",    4, newSViv(sip->si_band),   
0);
   2721                    EXTEND(SP, 2);
   2722                    PUSHs((SV*)rv);
   2723                    PUSHs(newSVpv((void*)sip, sizeof(*sip)));
   2724               }
   2725          }
   2726     }
   2727 #endif

Steve Peters
[EMAIL PROTECTED]

Reply via email to