]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/siginterrupt.3
b81a29c5231d057b343c2f4fad4ec5bcc8e8d74e
[thirdparty/man-pages.git] / man3 / siginterrupt.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\" References consulted:
6 .\" Linux libc source code
7 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
8 .\" 386BSD man pages
9 .\" Modified Sun Jul 25 10:40:51 1993 by Rik Faith (faith@cs.unc.edu)
10 .\" Modified Sun Apr 14 16:20:34 1996 by Andries Brouwer (aeb@cwi.nl)
11 .TH SIGINTERRUPT 3 2022-09-09 "Linux man-pages (unreleased)"
12 .SH NAME
13 siginterrupt \- allow signals to interrupt system calls
14 .SH LIBRARY
15 Standard C library
16 .RI ( libc ", " \-lc )
17 .SH SYNOPSIS
18 .nf
19 .B #include <signal.h>
20 .PP
21 .BI "int siginterrupt(int " sig ", int " flag );
22 .fi
23 .PP
24 .RS -4
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
27 .RE
28 .PP
29 .BR siginterrupt ():
30 .nf
31 _XOPEN_SOURCE >= 500
32 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
33 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
34 || /* Glibc <= 2.19: */ _BSD_SOURCE
35 .fi
36 .SH DESCRIPTION
37 The
38 .BR siginterrupt ()
39 function changes the restart behavior when
40 a system call is interrupted by the signal \fIsig\fP.
41 If the \fIflag\fP
42 argument is false (0), then system calls will be restarted if interrupted
43 by the specified signal \fIsig\fP.
44 This is the default behavior in Linux.
45 .PP
46 If the \fIflag\fP argument is true (1) and no data has been transferred,
47 then a system call interrupted by the signal \fIsig\fP will return \-1
48 and \fIerrno\fP will be set to
49 .BR EINTR .
50 .PP
51 If the \fIflag\fP argument is true (1) and data transfer has started,
52 then the system call will be interrupted and will return the actual
53 amount of data transferred.
54 .SH RETURN VALUE
55 The
56 .BR siginterrupt ()
57 function returns 0 on success.
58 It returns \-1 if the
59 signal number
60 .I sig
61 is invalid, with
62 .I errno
63 set to indicate the error.
64 .SH ERRORS
65 .TP
66 .B EINVAL
67 The specified signal number is invalid.
68 .SH ATTRIBUTES
69 For an explanation of the terms used in this section, see
70 .BR attributes (7).
71 .ad l
72 .nh
73 .TS
74 allbox;
75 lb lb lbx
76 l l l.
77 Interface Attribute Value
78 T{
79 .BR siginterrupt ()
80 T} Thread safety T{
81 MT-Unsafe const:sigintr
82 T}
83 .TE
84 .hy
85 .ad
86 .sp 1
87 .SH STANDARDS
88 4.3BSD, POSIX.1-2001.
89 POSIX.1-2008 marks
90 .BR siginterrupt ()
91 as obsolete, recommending the use of
92 .BR sigaction (2)
93 with the
94 .B SA_RESTART
95 flag instead.
96 .SH SEE ALSO
97 .BR signal (2)