Handling signals

In this section, we shall discuss in detail how exactly signals are handled by the application developer programmatically (using C code, of course).

Glance back at Figure 1.You can see how the OS performs default signal handling, which runs when an uncaught signal is delivered to the process. This seems good, until we realize that, pretty often, the default action is to simply kill (or terminate) the process. What if the application demands we do something else? Or, what if, realistically, the application does crash, instead of just abruptly dying (and perhaps leaving important files and other metadata in an inconsistent state). Perhaps we can put the program into a sane state by performing some required cleanup, flushing ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.