As I read this information from signal.h :

[CX<javascript:open_code('CX')>] [[Option Start]] The <signal.h> header shall 
define the siginfo_t type as a structure, which shall include at least the 
following members: [[Option End]]

[CX<javascript:open_code('CX')>][[Option Start]]

int           si_signo  Signal number.

int           si_code   Signal code.

[[Option End]]

[XSI<javascript:open_code('XSI')>][[Option Start]]

int           si_errno  If non-zero, an errno value associated with

                        this signal, as described in <errno.h>.

[[Option End]]

[CX<javascript:open_code('CX')>][[Option Start]]

pid_t         si_pid    Sending process ID.

uid_t         si_uid    Real user ID of sending process.

void         *si_addr   Address of faulting instruction.

int           si_status Exit value or signal.

[[Option End]]

[OB XSR<javascript:open_code('OB%20XSR')>][[Option Start]]

long          si_band   Band event for SIGPOLL.

[[Option End]]

[CX<javascript:open_code('CX')>][[Option Start]]

union sigval  si_value  Signal value.

[[Option End]]



All of the above members MUST be available in all occurrences of siginfo_t, 
whether or not they are applicable on a specific signal.

So can someone tell me how this siginfo_t definition matches the minimum set of 
members for ALL instances of siginfo_t?

typedef struct siginfo
  {
    int si_signo;               /* Signal number.  */
    int si_errno;               /* If non-zero, an errno value associated with
                                   this signal, as defined in <errno.h>.  */
    int si_code;                /* Signal code.  */

    union
      {
        int _pad[__SI_PAD_SIZE];

         /* kill().  */
        struct
          {
            __pid_t si_pid;     /* Sending process ID.  */
            __uid_t si_uid;     /* Real user ID of sending process.  */
          } _kill;

        /* POSIX.1b timers.  */
        struct
          {
            int si_tid;         /* Timer ID.  */
            int si_overrun;     /* Overrun count.  */
            sigval_t si_sigval; /* Signal value.  */
          } _timer;

        /* POSIX.1b signals.  */
        struct
          {
            __pid_t si_pid;     /* Sending process ID.  */
            __uid_t si_uid;     /* Real user ID of sending process.  */
            sigval_t si_sigval; /* Signal value.  */
          } _rt;

        /* SIGCHLD.  */
        struct
          {
            __pid_t si_pid;     /* Which child.  */
            __uid_t si_uid;     /* Real user ID of sending process.  */
            int si_status;      /* Exit value or signal.  */
            __clock_t si_utime;
            __clock_t si_stime;
          } _sigchld;
       /* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
        struct
          {
            void *si_addr;      /* Faulting insn/memory ref.  */
          } _sigfault;

        /* SIGPOLL.  */
        struct
          {
            long int si_band;   /* Band event for SIGPOLL.  */
            int si_fd;
          } _sigpoll;
      } _sifields;
  } siginfo_t;


/* X/Open requires some more fields with fixed names.  */
# define si_pid         _sifields._kill.si_pid
# define si_uid         _sifields._kill.si_uid
# define si_timerid     _sifields._timer.si_tid
# define si_overrun     _sifields._timer.si_overrun
# define si_status      _sifields._sigchld.si_status
# define si_utime       _sifields._sigchld.si_utime
# define si_stime       _sifields._sigchld.si_stime
# define si_value       _sifields._rt.si_sigval
# define si_int         _sifields._rt.si_sigval.sival_int
# define si_ptr         _sifields._rt.si_sigval.sival_ptr
# define si_addr        _sifields._sigfault.si_addr
# define si_band        _sifields._sigpoll.si_band
# define si_fd          _sifields._sigpoll.si_fd

Jeff Fellin

Reply via email to