mount_setattr.2: Minor tweaks to Christian's patch
[man-pages.git] / man3 / siginterrupt.3
blob07aad829c4905bae0698d01f7be657854ccdbd38
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified Sun Jul 25 10:40:51 1993 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified Sun Apr 14 16:20:34 1996 by Andries Brouwer (aeb@cwi.nl)
31 .TH SIGINTERRUPT 3 2021-03-22 "" "Linux Programmer's Manual"
32 .SH NAME
33 siginterrupt \- allow signals to interrupt system calls
34 .SH SYNOPSIS
35 .nf
36 .B #include <signal.h>
37 .PP
38 .BI "int siginterrupt(int " sig ", int " flag );
39 .fi
40 .PP
41 .RS -4
42 Feature Test Macro Requirements for glibc (see
43 .BR feature_test_macros (7)):
44 .RE
45 .PP
46 .BR siginterrupt ():
47 .nf
48     _XOPEN_SOURCE >= 500
49 .\"    || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
50         || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
51         || /* Glibc <= 2.19: */ _BSD_SOURCE
52 .fi
53 .SH DESCRIPTION
54 The
55 .BR siginterrupt ()
56 function changes the restart behavior when
57 a system call is interrupted by the signal \fIsig\fP.
58 If the \fIflag\fP
59 argument is false (0), then system calls will be restarted if interrupted
60 by the specified signal \fIsig\fP.
61 This is the default behavior in Linux.
62 .PP
63 If the \fIflag\fP argument is true (1) and no data has been transferred,
64 then a system call interrupted by the signal \fIsig\fP will return \-1
65 and \fIerrno\fP will be set to
66 .BR EINTR .
67 .PP
68 If the \fIflag\fP argument is true (1) and data transfer has started,
69 then the system call will be interrupted and will return the actual
70 amount of data transferred.
71 .SH RETURN VALUE
72 The
73 .BR siginterrupt ()
74 function returns 0 on success.
75 It returns \-1 if the
76 signal number
77 .I sig
78 is invalid, with
79 .I errno
80 set to indicate the error.
81 .SH ERRORS
82 .TP
83 .B EINVAL
84 The specified signal number is invalid.
85 .SH ATTRIBUTES
86 For an explanation of the terms used in this section, see
87 .BR attributes (7).
88 .ad l
89 .nh
90 .TS
91 allbox;
92 lb lb lbx
93 l l l.
94 Interface       Attribute       Value
96 .BR siginterrupt ()
97 T}      Thread safety   T{
98 MT-Unsafe const:sigintr
103 .sp 1
104 .SH CONFORMING TO
105 4.3BSD, POSIX.1-2001.
106 POSIX.1-2008 marks
107 .BR siginterrupt ()
108 as obsolete, recommending the use of
109 .BR sigaction (2)
110 with the
111 .B SA_RESTART
112 flag instead.
113 .SH SEE ALSO
114 .BR signal (2)