siginterrupt(3) (BSD Compatibility Package) siginterrupt(3)
NAME
siginterrupt - allow signals to interrupt system calls
SYNOPSIS
/usr/ucb/cc [flag ...] file ... -lucb
#include <signal.h>
int siginterrupt(int sig, int flag);
DESCRIPTION
siginterrupt is used to change the system call restart behavior when a
system call is interrupted by the specified signal. If the flag is
false (0), then system calls will be restarted if they are interrupted
by the specified signal and no data has been transferred yet. System
call restart is the default behavior when the signal routine is used.
The siginterrupt() function is used to change the restart behavior
when a function is interrupted by the specified signal. The function
siginterrupt(sig, flag) has an effect as if implemented as:
siginterrupt(int sig, int flag) {
int ret;
struct sigaction act;
(void) sigaction(sig, NULL, &act);
if (flag)
act.saflags &= ~SARESTART;
else
act.saflags |= SARESTART;
ret = sigaction(sig, &act, NULL);
return ret;
}
If the flag is true (1), then restarting of system calls is disabled.
If a system call is interrupted by the specified signal and no data
has been transferred, the system call will return -1 with errno set to
EINTR. Interrupted system calls that have started transferring data
will return the amount of data actually transferred.
Issuing a siginterrupt call during the execution of a signal handler
will cause the new action to take place on the next signal to be
caught.
ERRORS
The siginterrupt() function will fail if:
EINVAL The sig argument is not a valid signal number.
Page 1 Reliant UNIX 5.44 Printed 11/98
siginterrupt(3) (BSD Compatibility Package) siginterrupt(3)
RETURN VALUE
A 0 value indicates that the call succeeded. A -1 value indicates that
an invalid signal number has been supplied.
NOTES
The siginterrupt() function supports programs written to historical
system interfaces. A portable application, when being written or
rewritten, should use sigaction() with the SARESTART flag instead of
siginterrupt().
This library routine uses an extension of the sigvec system call that
is not available in BSD 4.2, hence it should not be used if backward
compatibility is needed.
SEE ALSO
sigaction(2), signal(2), sigblock(3), sigpause(3), sigsetmask(3),
sigvec(3), signal(3-ucb), signal(5).
Page 2 Reliant UNIX 5.44 Printed 11/98