This preview shows page 1. Sign up to view the full content.
Unformatted text preview: is an ugly aspect of Unix signal handling. To deal with this problem, the Posix standard deﬁnes the sigaction function, which allows users on Posixcompliant systems such as Linux and Solaris to clearly specify the signal-handling semantics they want.
#include <signal.h> int sigaction(int signum, struct sigaction *act, struct sigaction *oldact);
returns: 0 if OK, -1 on error The sigaction function is unwieldy because it requires the user to set the entries of a structure. A cleaner approach, originally proposed by Stevens , is to deﬁne a wrapper function, called Signal, that calls sigaction for us. Figure 8.31 shows the deﬁnition of Signal, which is invoked in the same way as the signal function. The Signal wrapper installs a signal handler with the following signal-handling semantics: ¯ ¯ Only signals of the type currently being processed by the handler are blocked. As with all signal implementations, signals are not queued. 8.5. SIGNALS 435
code/ecf/signal3.c 1 2 3 4 5 6 7 8 9 10 11 12...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American