]>
Commit | Line | Data |
---|---|---|
2fbdf533 | 1 | /* Uncancelable versions of cancelable interfaces. Linux/NPTL version. |
581c785b | 2 | Copyright (C) 2003-2022 Free Software Foundation, Inc. |
2c008571 | 3 | This file is part of the GNU C Library. |
2c008571 UD |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 | 16 | License along with the GNU C Library; if not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
2c008571 | 18 | |
34caaafd AZ |
19 | #ifndef NOT_CANCEL_H |
20 | # define NOT_CANCEL_H | |
21 | ||
c2284574 | 22 | #include <fcntl.h> |
2c008571 | 23 | #include <sysdep.h> |
34caaafd AZ |
24 | #include <errno.h> |
25 | #include <unistd.h> | |
eaad4f9e | 26 | #include <sys/poll.h> |
34caaafd | 27 | #include <sys/syscall.h> |
a8410a5f | 28 | #include <sys/wait.h> |
6f33fd04 | 29 | #include <time.h> |
2c008571 | 30 | |
c2284574 AZ |
31 | /* Non cancellable open syscall. */ |
32 | __typeof (open) __open_nocancel; | |
c2284574 AZ |
33 | |
34 | /* Non cancellable open syscall (LFS version). */ | |
35 | __typeof (open64) __open64_nocancel; | |
683040c3 | 36 | |
0bb2fabc AZ |
37 | /* Non cancellable openat syscall. */ |
38 | __typeof (openat) __openat_nocancel; | |
0bb2fabc AZ |
39 | |
40 | /* Non cacellable openat syscall (LFS version). */ | |
41 | __typeof (openat64) __openat64_nocancel; | |
0bb2fabc | 42 | |
a748eb31 AZ |
43 | /* Non cancellable read syscall. */ |
44 | __typeof (__read) __read_nocancel; | |
34caaafd | 45 | |
fed33b0f LP |
46 | /* Non cancellable pread syscall (LFS version). */ |
47 | __typeof (__pread64) __pread64_nocancel; | |
48 | ||
34caaafd | 49 | /* Uncancelable write. */ |
c647fb88 | 50 | __typeof (__write) __write_nocancel; |
2fbdf533 | 51 | |
2c008571 | 52 | /* Uncancelable close. */ |
c181840c | 53 | __typeof (__close) __close_nocancel; |
c181840c AZ |
54 | |
55 | /* Non cancellable close syscall that does not also set errno in case of | |
56 | failure. */ | |
57 | static inline void | |
58 | __close_nocancel_nostatus (int fd) | |
59 | { | |
60 | __close_nocancel (fd); | |
61 | } | |
2c008571 | 62 | |
19926de9 AZ |
63 | /* Non cancellable writev syscall that does not also set errno in case of |
64 | failure. */ | |
65 | static inline void | |
66 | __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) | |
67 | { | |
bc2eb932 | 68 | INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt); |
19926de9 | 69 | } |
73299943 | 70 | |
6f4e0fcf AZN |
71 | static inline int |
72 | __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags) | |
73 | { | |
eaad4f9e | 74 | return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags); |
6f4e0fcf AZN |
75 | } |
76 | ||
eaad4f9e JD |
77 | static inline int |
78 | __poll_infinity_nocancel (struct pollfd *fds, nfds_t nfds) | |
79 | { | |
80 | return INLINE_SYSCALL_CALL (ppoll, fds, nfds, NULL, NULL, 0); | |
81 | } | |
6f4e0fcf | 82 | |
2b0b9a1c | 83 | /* Uncancelable fcntl. */ |
06ab719d | 84 | __typeof (__fcntl) __fcntl64_nocancel; |
329ea513 ZW |
85 | |
86 | #if IS_IN (libc) || IS_IN (rtld) | |
87 | hidden_proto (__open_nocancel) | |
88 | hidden_proto (__open64_nocancel) | |
89 | hidden_proto (__openat_nocancel) | |
90 | hidden_proto (__openat64_nocancel) | |
91 | hidden_proto (__read_nocancel) | |
fed33b0f | 92 | hidden_proto (__pread64_nocancel) |
329ea513 ZW |
93 | hidden_proto (__write_nocancel) |
94 | hidden_proto (__close_nocancel) | |
06ab719d | 95 | hidden_proto (__fcntl64_nocancel) |
329ea513 | 96 | #endif |
2b0b9a1c | 97 | |
34caaafd | 98 | #endif /* NOT_CANCEL_H */ |