1 | /* Uncancelable versions of cancelable interfaces. Linux/NPTL version. |
2 | Copyright (C) 2003-2018 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. |
5 | |
6 | The GNU C Library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2.1 of the License, or (at your option) any later version. |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Lesser General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Lesser General Public |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ |
19 | |
20 | #ifndef NOT_CANCEL_H |
21 | # define NOT_CANCEL_H |
22 | |
23 | #include <fcntl.h> |
24 | #include <sysdep.h> |
25 | #include <errno.h> |
26 | #include <unistd.h> |
27 | #include <sys/syscall.h> |
28 | #include <sys/wait.h> |
29 | #include <time.h> |
30 | |
31 | /* Non cancellable open syscall. */ |
32 | __typeof (open) __open_nocancel; |
33 | libc_hidden_proto (__open_nocancel) |
34 | |
35 | /* Non cancellable open syscall (LFS version). */ |
36 | __typeof (open64) __open64_nocancel; |
37 | libc_hidden_proto (__open64_nocancel) |
38 | |
39 | /* Non cancellable openat syscall. */ |
40 | __typeof (openat) __openat_nocancel; |
41 | libc_hidden_proto (__openat_nocancel) |
42 | |
43 | /* Non cacellable openat syscall (LFS version). */ |
44 | __typeof (openat64) __openat64_nocancel; |
45 | libc_hidden_proto (__openat64_nocancel) |
46 | |
47 | /* Non cancellable read syscall. */ |
48 | __typeof (__read) __read_nocancel; |
49 | libc_hidden_proto (__read_nocancel) |
50 | |
51 | /* Uncancelable write. */ |
52 | __typeof (__write) __write_nocancel; |
53 | libc_hidden_proto (__write_nocancel) |
54 | |
55 | /* Uncancelable close. */ |
56 | __typeof (__close) __close_nocancel; |
57 | libc_hidden_proto (__close_nocancel) |
58 | |
59 | /* Non cancellable close syscall that does not also set errno in case of |
60 | failure. */ |
61 | static inline void |
62 | __close_nocancel_nostatus (int fd) |
63 | { |
64 | __close_nocancel (fd); |
65 | } |
66 | |
67 | /* Non cancellable writev syscall that does not also set errno in case of |
68 | failure. */ |
69 | static inline void |
70 | __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) |
71 | { |
72 | INTERNAL_SYSCALL_DECL (err); |
73 | INTERNAL_SYSCALL_CALL (writev, err, fd, iov, iovcnt); |
74 | } |
75 | |
76 | /* Uncancelable waitpid. */ |
77 | __typeof (waitpid) __waitpid_nocancel; |
78 | libc_hidden_proto (__waitpid_nocancel) |
79 | |
80 | /* Uncancelable pause. */ |
81 | __typeof (pause) __pause_nocancel; |
82 | libc_hidden_proto (__pause_nocancel) |
83 | |
84 | /* Uncancelable nanosleep. */ |
85 | __typeof (__nanosleep) __nanosleep_nocancel; |
86 | hidden_proto (__nanosleep_nocancel) |
87 | |
88 | /* Uncancelable fcntl. */ |
89 | __typeof (__fcntl) __fcntl_nocancel; |
90 | libc_hidden_proto (__fcntl_nocancel) |
91 | |
92 | #endif /* NOT_CANCEL_H */ |
93 | |