Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

20. Signals: Fundamental Concepts > Displaying Signal Descriptions

Displaying Signal Descriptions

Each signal has an associated printable description. These descriptions are listed in the array sys_siglist. For example, we can refer to sys_siglist[SIGPIPE] to get the description for SIGPIPE (broken pipe). However, rather than using the sys_siglist array directly, the strsignal() function is preferable.

#define _BSD_SOURCE
#include <signal.h>

extern const char *const sys_siglist[];

#define _GNU_SOURCE
#include <string.h>

char *strsignal(int sig);

Note

Returns pointer to signal description string

The strsignal() function performs bounds checking on the sig argument, and then returns a pointer to a printable description of the signal, or a pointer to an error string if the signal number was invalid. (On some other UNIX implementations, strsignal() returns NULL if sig is invalid.)


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint