SIGINTERRUPT(3)

NAME
siginterrupt - allow signals to interrupt slow system calls

SYNOPSIS
siginterrupt(sig, flag);
int sig, flag;

DESCRIPTION
Siginterrupt is used to change the system call restart behavior when a slow system call is interrupted by the specified signal. ``Slow'' system calls are those which can potentially wait indefinitely to be completed, and include blocking reads and writes on a tty, pipe or FIFO, the various forms of wait(3), and the F_SETLKW command to fcntl(2). For a system call to be interrupted means that the program catches the specified signal and then simply returns from the signal handler, without having modified the signal context.

If the flag is false (0), then slow system calls will be restarted if they are interrupted by the specified signal and either the call was not a read or a write, or else no data has yet been transferred. System call restart is the default behavior for programs which use the BSD version of the signal(3c) function.

If the flag is true (1), then restarting of system calls is disabled. If a read or write is interrupted by the specified signal and no data has been transferred, and for calls other than read or write, -1 will be returned, with errno set to EINTR. Interrupted read or write calls that have started transferring data will return the amount of data actually transferred; no error will be reported. System call interrupt is the default behaviour for programs which use the X/Open compliant version of signal(3c), or the X/Open-defined sigaction(3) function. System call interrupt is also the signal behaviour found on 4.1 BSD and AT&T System V UNIX systems.

Note that the new 4.2 BSD signal handling semantics are not altered in any other way. Most notably, signal handlers always remain installed until explicitly changed by a subsequent sigvec(2) call, and the signal mask operates as documented in sigvec(2). Programs may switch between restartable and interruptible system call operation as often as desired in the execution of a program.

Issuing a siginterrupt(3) call during the execution of a signal handler will cause the new action to take place on the next signal to be caught.

RETURN VALUE
A 0 value indicates that the call succeeded. A -1 value indicates that an invalid signal number has been supplied.

SEE ALSO
sigvec(2), sigblock(2), signal(3c) sigpause(2), sigsetmask(2).