1/* Uncancelable versions of cancelable interfaces. Linux/NPTL version.
2 Copyright (C) 2003-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef NOT_CANCEL_H
20# define NOT_CANCEL_H
21
22#include <fcntl.h>
23#include <sysdep.h>
24#include <errno.h>
25#include <unistd.h>
26#include <sys/syscall.h>
27#include <sys/wait.h>
28#include <time.h>
29
30/* Non cancellable open syscall. */
31__typeof (open) __open_nocancel;
32
33/* Non cancellable open syscall (LFS version). */
34__typeof (open64) __open64_nocancel;
35
36/* Non cancellable openat syscall. */
37__typeof (openat) __openat_nocancel;
38
39/* Non cacellable openat syscall (LFS version). */
40__typeof (openat64) __openat64_nocancel;
41
42/* Non cancellable read syscall. */
43__typeof (__read) __read_nocancel;
44
45/* Non cancellable pread syscall (LFS version). */
46__typeof (__pread64) __pread64_nocancel;
47
48/* Uncancelable write. */
49__typeof (__write) __write_nocancel;
50
51/* Uncancelable close. */
52__typeof (__close) __close_nocancel;
53
54/* Non cancellable close syscall that does not also set errno in case of
55 failure. */
56static inline void
57__close_nocancel_nostatus (int fd)
58{
59 __close_nocancel (fd);
60}
61
62/* Non cancellable writev syscall that does not also set errno in case of
63 failure. */
64static inline void
65__writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
66{
67 INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
68}
69
70/* Uncancelable fcntl. */
71__typeof (__fcntl) __fcntl64_nocancel;
72
73#if IS_IN (libc) || IS_IN (rtld)
74hidden_proto (__open_nocancel)
75hidden_proto (__open64_nocancel)
76hidden_proto (__openat_nocancel)
77hidden_proto (__openat64_nocancel)
78hidden_proto (__read_nocancel)
79hidden_proto (__pread64_nocancel)
80hidden_proto (__write_nocancel)
81hidden_proto (__close_nocancel)
82hidden_proto (__fcntl64_nocancel)
83#endif
84
85#endif /* NOT_CANCEL_H */
86

source code of glibc/sysdeps/unix/sysv/linux/not-cancel.h