Thursday 15 July 2010

c - Signal handler for all signal -


How can I register the signal handler for all the signals available on the OS running on the signal (3)?

My code looks like this:

  zero sig_handler (int signum) {printf ("received signal% d \ n", signal); } Int main () {hint (ALL_SIGNALS _ ??, sig_handler); While (1) {sleep (1); }; Return 0; }    

In most systems, a macro nsig or _NSSIg (defined in signal.h ) It is believed that for a loop (i = 1; i & lt) in pre-criterion-conformance mode Will not be available because it violates the namespace); _NSIG; In addition, there are signal masks on the POSIX system, CHAR_BIT * sizeof (sigset_t) is an upper bound on the number of signals that you do not have to either NSG can not be used as a nor as a return book _NSIG is defined.

No comments:

Post a Comment