xref: /csrg-svn/lib/libc/gen/siginterrupt.3 (revision 48352)
1*48352Scael.\" Copyright (c) 1985, 1991 Regents of the University of California.
2*48352Scael.\" All rights reserved.
320616Smckusick.\"
4*48352Scael.\" %sccs.include.redist.man%
520616Smckusick.\"
6*48352Scael.\"     @(#)siginterrupt.3	6.2 (Berkeley) 04/19/91
7*48352Scael.\"
8*48352Scael.Dd
9*48352Scael.Dt SIGINTERRUPT 3
10*48352Scael.Os BSD 4.3
11*48352Scael.Sh NAME
12*48352Scael.Nm siginterrupt
13*48352Scael.Nd allow signals to interrupt system calls
14*48352Scael.Sh SYNOPSIS
15*48352Scael.Fd #include <signal.h>
16*48352Scael.Ft int
17*48352Scael.Fn siginterrupt "int sig" "int flag"
18*48352Scael.Sh DESCRIPTION
19*48352ScaelThe
20*48352Scael.Fn siginterrupt
21*48352Scaelfunction
2220616Smckusickis used to change the system call restart
2320616Smckusickbehavior when a system call is interrupted by the specified signal.
2420616SmckusickIf the flag is false (0), then system calls will be restarted if
2520616Smckusickthey are interrupted by the specified signal
2620616Smckusickand no data has been transferred yet.
27*48352ScaelSystem call restart is the default behavior on
28*48352Scael.Bx 4.2 .
29*48352Scael.Pp
30*48352ScaelIf the flag is true (1),
31*48352Scaelthen restarting of system calls is disabled.
3220616SmckusickIf a system call is interrupted by the specified signal
3320616Smckusickand no data has been transferred,
34*48352Scaelthe system call will return \-1 with the global variable
35*48352Scael.Va errno
36*48352Scaelset to
37*48352Scael.Dv EINTR .
3820616SmckusickInterrupted system calls that have started transferring
3920616Smckusickdata will return the amount of data actually transferred.
40*48352ScaelSystem call interrupt is the signal behavior found on
41*48352Scael.Bx 4.1
42*48352Scaeland
43*48352Scael.At V
44*48352Scaelsystems.
45*48352Scael.Pp
46*48352ScaelNote that the new
47*48352Scael.Bx 4.2
48*48352Scaelsignal handling semantics are not
4920616Smckusickaltered in any other way.
5020616SmckusickMost notably, signal handlers always remain installed until
5120616Smckusickexplicitly changed by a subsequent
52*48352Scael.Xr sigaction 2
5320616Smckusickcall, and the signal mask operates as documented in
54*48352Scael.Xr sigaction 2 .
5520616SmckusickPrograms may switch between restartable and interruptible
5620616Smckusicksystem call operation as often as desired in the execution of a program.
57*48352Scael.Pp
5820616SmckusickIssuing a
59*48352Scael.Fn siginterrupt 3
6020616Smckusickcall during the execution of a signal handler will cause
6120616Smckusickthe new action to take place on the next signal to be caught.
62*48352Scael.Sh NOTES
6320616SmckusickThis library routine uses an extension of the
64*48352Scael.Xr sigaction 2
65*48352Scaelsystem call that is not available in
66*48352Scael.Bx 4.2 ,
6720616Smckusickhence it should not be used if backward compatibility is needed.
68*48352Scael.Sh RETURN VALUES
6920616SmckusickA 0 value indicates that the call succeeded.
70*48352ScaelA \-1 value indicates that an invalid signal number has been supplied.
71*48352Scael.Sh SEE ALSO
72*48352Scael.Xr sigaction 2 ,
73*48352Scael.Xr sigblock 2 ,
74*48352Scael.Xr sigpause 2 ,
75*48352Scael.Xr sigsetmask 2 .
76*48352Scael.Sh HISTORY
77*48352ScaelThe
78*48352Scael.Fn siginterrupt
79*48352Scaelfunction appeared in
80*48352Scael.Bx 4.3 .
81