delorie.com/djgpp/doc/libc/libc_717.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

sigaction

Syntax

 
#include <signal.h>

int sigaction (int sig, const struct sigaction *act,
               struct sigaction *oact);

Description

This function allows to examine and/or change the action associated with a signal sig. The struct sigaction structure, defined by the header file `signal.h', is declared as follows:

 
 struct sigaction {
   int sa_flags;             /* flags for the action;
                              * currently ignored */
   void (*sa_handler)(int);  /* the handler for the signal */
   sigset_t sa_mask;         /* additional signals to be blocked */
 };

The sa_handler member is a signal handler, see signal. The sa_mask member defines the signals, in addition to sig, which are to be blocked during the execution of sa_handler.

The sigaction function sets the structure pointed to by oact to the current action for the signal sig, and then sets the new action for sig as specified by act. If the act argument is NULL, sigaction returns the current signal action in oact, but doesn't change it. If the oact argument is a NULL pointer, it is ignored. Thus, passing NULL pointers for both act and oact is a way to see if sig is a valid signal number on this system (if not, sigaction will return -1 and set errno).

Return Value

0 on success, -1 for illegal value of sig.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004