1 /* Uncancelable versions of cancelable interfaces. Hurd version.
2 Copyright (C) 2003-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
28 #include <sys/random.h>
32 /* Non cancellable close syscall. */
33 __typeof (__close
) __close_nocancel
;
35 void __close_nocancel_nostatus (int fd
);
37 /* Non cancellable open syscall. */
38 __typeof (__open
) __open_nocancel
;
39 /* open64 is just the same as open for us. */
40 #define __open64_nocancel(...) \
41 __open_nocancel (__VA_ARGS__)
43 /* Non cancellable openat syscall. */
44 __typeof (__openat
) __openat_nocancel
;
45 /* open64 is just the same as open for us. */
46 #define __openat64_nocancel(...) \
47 __openat_nocancel (__VA_ARGS__)
49 /* Non cancellable read syscall. */
50 __typeof (__read
) __read_nocancel
;
52 /* Non cancellable pread syscall (LFS version). */
53 __typeof (__pread64
) __pread64_nocancel
;
55 /* Non cancellable write syscall. */
56 __typeof (__write
) __write_nocancel
;
58 /* Non cancellable pwrite syscall (LFS version). */
59 __typeof (__pwrite64
) __pwrite64_nocancel
;
61 /* Non cancellable writev syscall. */
62 __typeof (__writev
) __writev_nocancel
;
64 /* Non cancellable writev syscall with no status. */
65 void __writev_nocancel_nostatus (int fd
, const struct iovec
*vector
, int count
);
67 /* Non cancellable wait4 syscall. */
68 __typeof (__wait4
) __wait4_nocancel
;
70 # define __waitpid_nocancel(pid, stat_loc, options) \
71 __wait4_nocancel (pid, stat_loc, options, NULL)
73 /* Non cancellable fcntl syscall. */
74 __typeof (__fcntl
) __fcntl_nocancel
;
75 /* fcntl64 is just the same as fcntl for us. */
76 #define __fcntl64_nocancel(...) \
77 __fcntl_nocancel (__VA_ARGS__)
79 /* Non cancellable getrandom syscall that does not also set errno in case of
82 __getrandom_nocancel_nostatus (void *buf
, size_t buflen
, unsigned int flags
)
84 int save_errno
= errno
;
85 ssize_t r
= __getrandom (buf
, buflen
, flags
);
86 r
= r
== -1 ? -errno
: r
;
87 __set_errno (save_errno
);
91 #define __getrandom_nocancel(buf, size, flags) \
92 __getrandom (buf, size, flags)
94 #define __poll_infinity_nocancel(fds, nfds) \
95 __poll (fds, nfds, -1)
98 hidden_proto (__close_nocancel
)
99 hidden_proto (__close_nocancel_nostatus
)
100 hidden_proto (__open_nocancel
)
101 hidden_proto (__openat_nocancel
)
102 hidden_proto (__read_nocancel
)
103 hidden_proto (__pread64_nocancel
)
104 hidden_proto (__write_nocancel
)
105 hidden_proto (__pwrite64_nocancel
)
106 hidden_proto (__writev_nocancel
)
107 hidden_proto (__writev_nocancel_nostatus
)
108 hidden_proto (__wait4_nocancel
)
109 hidden_proto (__fcntl_nocancel
)
112 #endif /* NOT_CANCEL_H */