Commit | Line | Data |
---|---|---|
74155b62 KB |
1 | .\" Copyright (c) 1985, 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
53e9b2ee | 3 | .\" |
ad787160 C |
4 | .\" Redistribution and use in source and binary forms, with or without |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
53e9b2ee | 19 | .\" |
ad787160 C |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
ae59e04c | 31 | .\" |
ad787160 C |
32 | .\" @(#)siginterrupt.3 8.1 (Berkeley) 6/4/93 |
33 | .\" | |
34 | .Dd June 4, 1993 | |
ae59e04c CL |
35 | .Dt SIGINTERRUPT 3 |
36 | .Os BSD 4.3 | |
37 | .Sh NAME | |
38 | .Nm siginterrupt | |
39 | .Nd allow signals to interrupt system calls | |
40 | .Sh SYNOPSIS | |
41 | .Fd #include <signal.h> | |
42 | .Ft int | |
43 | .Fn siginterrupt "int sig" "int flag" | |
44 | .Sh DESCRIPTION | |
45 | The | |
46 | .Fn siginterrupt | |
47 | function | |
53e9b2ee KM |
48 | is used to change the system call restart |
49 | behavior when a system call is interrupted by the specified signal. | |
50 | If the flag is false (0), then system calls will be restarted if | |
51 | they are interrupted by the specified signal | |
52 | and no data has been transferred yet. | |
ae59e04c CL |
53 | System call restart is the default behavior on |
54 | .Bx 4.2 . | |
55 | .Pp | |
56 | If the flag is true (1), | |
57 | then restarting of system calls is disabled. | |
53e9b2ee KM |
58 | If a system call is interrupted by the specified signal |
59 | and no data has been transferred, | |
ae59e04c CL |
60 | the system call will return \-1 with the global variable |
61 | .Va errno | |
62 | set to | |
63 | .Dv EINTR . | |
53e9b2ee KM |
64 | Interrupted system calls that have started transferring |
65 | data will return the amount of data actually transferred. | |
ae59e04c CL |
66 | System call interrupt is the signal behavior found on |
67 | .Bx 4.1 | |
68 | and | |
69 | .At V | |
70 | systems. | |
71 | .Pp | |
72 | Note that the new | |
73 | .Bx 4.2 | |
74 | signal handling semantics are not | |
53e9b2ee KM |
75 | altered in any other way. |
76 | Most notably, signal handlers always remain installed until | |
77 | explicitly changed by a subsequent | |
ae59e04c | 78 | .Xr sigaction 2 |
53e9b2ee | 79 | call, and the signal mask operates as documented in |
ae59e04c | 80 | .Xr sigaction 2 . |
53e9b2ee KM |
81 | Programs may switch between restartable and interruptible |
82 | system call operation as often as desired in the execution of a program. | |
ae59e04c | 83 | .Pp |
53e9b2ee | 84 | Issuing a |
ae59e04c | 85 | .Fn siginterrupt 3 |
53e9b2ee KM |
86 | call during the execution of a signal handler will cause |
87 | the new action to take place on the next signal to be caught. | |
ae59e04c | 88 | .Sh NOTES |
53e9b2ee | 89 | This library routine uses an extension of the |
ae59e04c CL |
90 | .Xr sigaction 2 |
91 | system call that is not available in | |
92 | .Bx 4.2 , | |
53e9b2ee | 93 | hence it should not be used if backward compatibility is needed. |
ae59e04c | 94 | .Sh RETURN VALUES |
53e9b2ee | 95 | A 0 value indicates that the call succeeded. |
ae59e04c CL |
96 | A \-1 value indicates that an invalid signal number has been supplied. |
97 | .Sh SEE ALSO | |
98 | .Xr sigaction 2 , | |
99 | .Xr sigblock 2 , | |
100 | .Xr sigpause 2 , | |
101 | .Xr sigsetmask 2 . | |
102 | .Sh HISTORY | |
103 | The | |
104 | .Fn siginterrupt | |
105 | function appeared in | |
106 | .Bx 4.3 . |