macro and text revision (-mdoc version 3)
[unix-history] / usr / src / lib / libc / gen / siginterrupt.3
CommitLineData
ae59e04c
CL
1.\" Copyright (c) 1985, 1991 Regents of the University of California.
2.\" All rights reserved.
53e9b2ee 3.\"
ae59e04c 4.\" %sccs.include.redist.man%
53e9b2ee 5.\"
ae59e04c
CL
6.\" @(#)siginterrupt.3 6.2 (Berkeley) %G%
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
53e9b2ee
KM
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.
ae59e04c
CL
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.
53e9b2ee
KM
32If a system call is interrupted by the specified signal
33and no data has been transferred,
ae59e04c
CL
34the system call will return \-1 with the global variable
35.Va errno
36set to
37.Dv EINTR .
53e9b2ee
KM
38Interrupted system calls that have started transferring
39data will return the amount of data actually transferred.
ae59e04c
CL
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
53e9b2ee
KM
49altered in any other way.
50Most notably, signal handlers always remain installed until
51explicitly changed by a subsequent
ae59e04c 52.Xr sigaction 2
53e9b2ee 53call, and the signal mask operates as documented in
ae59e04c 54.Xr sigaction 2 .
53e9b2ee
KM
55Programs may switch between restartable and interruptible
56system call operation as often as desired in the execution of a program.
ae59e04c 57.Pp
53e9b2ee 58Issuing a
ae59e04c 59.Fn siginterrupt 3
53e9b2ee
KM
60call during the execution of a signal handler will cause
61the new action to take place on the next signal to be caught.
ae59e04c 62.Sh NOTES
53e9b2ee 63This library routine uses an extension of the
ae59e04c
CL
64.Xr sigaction 2
65system call that is not available in
66.Bx 4.2 ,
53e9b2ee 67hence it should not be used if backward compatibility is needed.
ae59e04c 68.Sh RETURN VALUES
53e9b2ee 69A 0 value indicates that the call succeeded.
ae59e04c
CL
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 .