xref: /csrg-svn/lib/libc/gen/siginterrupt.3 (revision 61111)
1*61111Sbostic.\" Copyright (c) 1985, 1991, 1993
2*61111Sbostic.\"	The Regents of the University of California.  All rights reserved.
320616Smckusick.\"
448352Scael.\" %sccs.include.redist.man%
520616Smckusick.\"
6*61111Sbostic.\"     @(#)siginterrupt.3	8.1 (Berkeley) 06/04/93
748352Scael.\"
848352Scael.Dd
948352Scael.Dt SIGINTERRUPT 3
1048352Scael.Os BSD 4.3
1148352Scael.Sh NAME
1248352Scael.Nm siginterrupt
1348352Scael.Nd allow signals to interrupt system calls
1448352Scael.Sh SYNOPSIS
1548352Scael.Fd #include <signal.h>
1648352Scael.Ft int
1748352Scael.Fn siginterrupt "int sig" "int flag"
1848352Scael.Sh DESCRIPTION
1948352ScaelThe
2048352Scael.Fn siginterrupt
2148352Scaelfunction
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.
2748352ScaelSystem call restart is the default behavior on
2848352Scael.Bx 4.2 .
2948352Scael.Pp
3048352ScaelIf the flag is true (1),
3148352Scaelthen restarting of system calls is disabled.
3220616SmckusickIf a system call is interrupted by the specified signal
3320616Smckusickand no data has been transferred,
3448352Scaelthe system call will return \-1 with the global variable
3548352Scael.Va errno
3648352Scaelset to
3748352Scael.Dv EINTR .
3820616SmckusickInterrupted system calls that have started transferring
3920616Smckusickdata will return the amount of data actually transferred.
4048352ScaelSystem call interrupt is the signal behavior found on
4148352Scael.Bx 4.1
4248352Scaeland
4348352Scael.At V
4448352Scaelsystems.
4548352Scael.Pp
4648352ScaelNote that the new
4748352Scael.Bx 4.2
4848352Scaelsignal handling semantics are not
4920616Smckusickaltered in any other way.
5020616SmckusickMost notably, signal handlers always remain installed until
5120616Smckusickexplicitly changed by a subsequent
5248352Scael.Xr sigaction 2
5320616Smckusickcall, and the signal mask operates as documented in
5448352Scael.Xr sigaction 2 .
5520616SmckusickPrograms may switch between restartable and interruptible
5620616Smckusicksystem call operation as often as desired in the execution of a program.
5748352Scael.Pp
5820616SmckusickIssuing a
5948352Scael.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.
6248352Scael.Sh NOTES
6320616SmckusickThis library routine uses an extension of the
6448352Scael.Xr sigaction 2
6548352Scaelsystem call that is not available in
6648352Scael.Bx 4.2 ,
6720616Smckusickhence it should not be used if backward compatibility is needed.
6848352Scael.Sh RETURN VALUES
6920616SmckusickA 0 value indicates that the call succeeded.
7048352ScaelA \-1 value indicates that an invalid signal number has been supplied.
7148352Scael.Sh SEE ALSO
7248352Scael.Xr sigaction 2 ,
7348352Scael.Xr sigblock 2 ,
7448352Scael.Xr sigpause 2 ,
7548352Scael.Xr sigsetmask 2 .
7648352Scael.Sh HISTORY
7748352ScaelThe
7848352Scael.Fn siginterrupt
7948352Scaelfunction appeared in
8048352Scael.Bx 4.3 .
81