xref: /original-bsd/lib/libc/gen/siginterrupt.3 (revision c3e32dec)
1.\" Copyright (c) 1985, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)siginterrupt.3	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt SIGINTERRUPT 3
10.Os BSD 4.3
11.Sh NAME
12.Nm siginterrupt
13.Nd allow signals to interrupt system calls
14.Sh SYNOPSIS
15.Fd #include <signal.h>
16.Ft int
17.Fn siginterrupt "int sig" "int flag"
18.Sh DESCRIPTION
19The
20.Fn siginterrupt
21function
22is used to change the system call restart
23behavior when a system call is interrupted by the specified signal.
24If the flag is false (0), then system calls will be restarted if
25they are interrupted by the specified signal
26and no data has been transferred yet.
27System call restart is the default behavior on
28.Bx 4.2 .
29.Pp
30If the flag is true (1),
31then restarting of system calls is disabled.
32If a system call is interrupted by the specified signal
33and no data has been transferred,
34the system call will return \-1 with the global variable
35.Va errno
36set to
37.Dv EINTR .
38Interrupted system calls that have started transferring
39data will return the amount of data actually transferred.
40System call interrupt is the signal behavior found on
41.Bx 4.1
42and
43.At V
44systems.
45.Pp
46Note that the new
47.Bx 4.2
48signal handling semantics are not
49altered in any other way.
50Most notably, signal handlers always remain installed until
51explicitly changed by a subsequent
52.Xr sigaction 2
53call, and the signal mask operates as documented in
54.Xr sigaction 2 .
55Programs may switch between restartable and interruptible
56system call operation as often as desired in the execution of a program.
57.Pp
58Issuing a
59.Fn siginterrupt 3
60call during the execution of a signal handler will cause
61the new action to take place on the next signal to be caught.
62.Sh NOTES
63This library routine uses an extension of the
64.Xr sigaction 2
65system call that is not available in
66.Bx 4.2 ,
67hence it should not be used if backward compatibility is needed.
68.Sh RETURN VALUES
69A 0 value indicates that the call succeeded.
70A \-1 value indicates that an invalid signal number has been supplied.
71.Sh SEE ALSO
72.Xr sigaction 2 ,
73.Xr sigblock 2 ,
74.Xr sigpause 2 ,
75.Xr sigsetmask 2 .
76.Sh HISTORY
77The
78.Fn siginterrupt
79function appeared in
80.Bx 4.3 .
81