SYNOPSIS
#include <signal.h>
void (*bsd_signal(int sig, void (*func)(int)))(int);
DESCRIPTION
The
The function call bsd_signal(sig, func) has an effect as if implemented as:
void (*bsd_signal(int sig, void (*func)(int)))(int) { struct sigaction act, oact; act.sa_handler = func; act.sa_flags = SA_RESTART; sigemptyset(&act.sa_mask); sigaddset(&act.sa_mask, sig); if (sigaction(sig, &act, &oact) == -1) return SIG_ERR; return oact.sa_handler; }
The handler function should be declared as:
void handler(int sig);
where sig is the signal number. The behavior is undefined if func is a function that takes more than one argument, or an argument of a different type.
PARAMETERS
- sig
-
Is the signal number for which the signal is to be installed.
- func
-
Is the signal handler function, declared as shown above.
RETURN VALUES
On success,
- EINVAL
-
The value of sig is an invalid or unsupported signal number, or
bsd_signal() attempted to catch a signal that cannot be caught, or the function tried to ignore a signal that cannot be ignored.
CONFORMANCE
UNIX 98
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
sigaction() ,sigaddset() ,sigemptyset() ,signal()
PTC MKS Toolkit 10.4 Documentation Build 39.