| 1 | .\" Copyright (c) 1985, 1991 Regents of the University of California. |
| 2 | .\" All rights reserved. |
| 3 | .\" |
| 4 | .\" %sccs.include.redist.man% |
| 5 | .\" |
| 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 |
| 19 | The |
| 20 | .Fn siginterrupt |
| 21 | function |
| 22 | is used to change the system call restart |
| 23 | behavior when a system call is interrupted by the specified signal. |
| 24 | If the flag is false (0), then system calls will be restarted if |
| 25 | they are interrupted by the specified signal |
| 26 | and no data has been transferred yet. |
| 27 | System call restart is the default behavior on |
| 28 | .Bx 4.2 . |
| 29 | .Pp |
| 30 | If the flag is true (1), |
| 31 | then restarting of system calls is disabled. |
| 32 | If a system call is interrupted by the specified signal |
| 33 | and no data has been transferred, |
| 34 | the system call will return \-1 with the global variable |
| 35 | .Va errno |
| 36 | set to |
| 37 | .Dv EINTR . |
| 38 | Interrupted system calls that have started transferring |
| 39 | data will return the amount of data actually transferred. |
| 40 | System call interrupt is the signal behavior found on |
| 41 | .Bx 4.1 |
| 42 | and |
| 43 | .At V |
| 44 | systems. |
| 45 | .Pp |
| 46 | Note that the new |
| 47 | .Bx 4.2 |
| 48 | signal handling semantics are not |
| 49 | altered in any other way. |
| 50 | Most notably, signal handlers always remain installed until |
| 51 | explicitly changed by a subsequent |
| 52 | .Xr sigaction 2 |
| 53 | call, and the signal mask operates as documented in |
| 54 | .Xr sigaction 2 . |
| 55 | Programs may switch between restartable and interruptible |
| 56 | system call operation as often as desired in the execution of a program. |
| 57 | .Pp |
| 58 | Issuing a |
| 59 | .Fn siginterrupt 3 |
| 60 | call during the execution of a signal handler will cause |
| 61 | the new action to take place on the next signal to be caught. |
| 62 | .Sh NOTES |
| 63 | This library routine uses an extension of the |
| 64 | .Xr sigaction 2 |
| 65 | system call that is not available in |
| 66 | .Bx 4.2 , |
| 67 | hence it should not be used if backward compatibility is needed. |
| 68 | .Sh RETURN VALUES |
| 69 | A 0 value indicates that the call succeeded. |
| 70 | A \-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 |
| 77 | The |
| 78 | .Fn siginterrupt |
| 79 | function appeared in |
| 80 | .Bx 4.3 . |