O'Reilly logo

Hands-On System Programming with Linux by Kaiwan N Billimoria

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The siginfo_t structure

When you use the SA_SIGINFO signal flag and a trapped signal occurs, the kernel populates a data structure: the siginfo_t structure.

The siginfo_t structure definition (slightly simplified; there is some #if wrapping around the first few members which we need not worry about here) is shown next(It's in the header /usr/include/x86_64-linux-gnu/bits/types/siginfo_t.h on Ubuntu  and /usr/include/bits/types/siginfo_t.h on a Fedora box): 

typedef struct {    int si_signo; /* Signal number. */    int si_code;      int si_errno; /* If non-zero, an errno value associated with           this signal, as defined in <errno.h>. */    union    {         int _pad[__SI_PAD_SIZE];        /* kill(). */         struct         {             __pid_t si_pid; /* Sending process ID. */ __uid_t si_uid; /* ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required