Update copyright notices with scripts/update-copyrights
[glibc.git] / nptl / sysdeps / unix / sysv / linux / i386 / not-cancel.h
blobbc17107239d27b80a6aae4898a2bf0f8069a6515
1 /* Uncancelable versions of cancelable interfaces. Linux/NPTL version.
2 Copyright (C) 2003-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
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.
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.
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/>. */
20 #include <sysdep.h>
22 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
23 extern int __open_nocancel (const char *, int, ...) attribute_hidden;
24 extern int __close_nocancel (int) attribute_hidden;
25 extern int __read_nocancel (int, void *, size_t) attribute_hidden;
26 extern int __write_nocancel (int, const void *, size_t) attribute_hidden;
27 extern pid_t __waitpid_nocancel (pid_t, int *, int) attribute_hidden;
28 extern int __openat_nocancel (int fd, const char *fname, int oflag,
29 mode_t mode) attribute_hidden;
30 extern int __openat64_nocancel (int fd, const char *fname, int oflag,
31 mode_t mode) attribute_hidden;
32 #else
33 # define __open_nocancel(name, ...) __open (name, __VA_ARGS__)
34 # define __close_nocancel(fd) __close (fd)
35 # define __read_nocancel(fd, buf, len) __read (fd, buf, len)
36 # define __write_nocancel(fd, buf, len) __write (fd, buf, len)
37 # define __waitpid_nocancel(pid, stat_loc, options) \
38 __waitpid (pid, stat_loc, options)
39 # define __openat_nocancel(fd, fname, oflag, mode) \
40 openat (fd, fname, oflag, mode)
41 # define __openat64_nocancel(fd, fname, oflag, mode) \
42 openat64 (fd, fname, oflag, mode)
43 #endif
45 /* Uncancelable open. */
46 #define open_not_cancel(name, flags, mode) \
47 __open_nocancel (name, flags, mode)
48 #define open_not_cancel_2(name, flags) \
49 __open_nocancel (name, flags)
51 /* Uncancelable openat. */
52 #define openat_not_cancel(fd, fname, oflag, mode) \
53 __openat_nocancel (fd, fname, oflag, mode)
54 #define openat_not_cancel_3(fd, fname, oflag) \
55 __openat_nocancel (fd, fname, oflag, 0)
56 #define openat64_not_cancel(fd, fname, oflag, mode) \
57 __openat64_nocancel (fd, fname, oflag, mode)
58 #define openat64_not_cancel_3(fd, fname, oflag) \
59 __openat64_nocancel (fd, fname, oflag, 0)
61 /* Uncancelable close. */
62 #define close_not_cancel(fd) \
63 __close_nocancel (fd)
64 #define close_not_cancel_no_status(fd) \
65 (void) ({ INTERNAL_SYSCALL_DECL (err); \
66 INTERNAL_SYSCALL (close, err, 1, (fd)); })
68 /* Uncancelable read. */
69 #define read_not_cancel(fd, buf, n) \
70 __read_nocancel (fd, buf, n)
72 /* Uncancelable write. */
73 #define write_not_cancel(fd, buf, n) \
74 __write_nocancel (fd, buf, n)
76 /* Uncancelable writev. */
77 #define writev_not_cancel_no_status(fd, iov, n) \
78 (void) ({ INTERNAL_SYSCALL_DECL (err); \
79 INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); })
81 /* Uncancelable fcntl. */
82 #define fcntl_not_cancel(fd, cmd, val) \
83 __fcntl_nocancel (fd, cmd, val)
85 /* Uncancelable waitpid. */
86 #ifdef __NR_waitpid
87 # define waitpid_not_cancel(pid, stat_loc, options) \
88 __waitpid_nocancel (pid, stat_loc, options)
89 #else
90 # define waitpid_not_cancel(pid, stat_loc, options) \
91 INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
92 #endif
94 /* Uncancelable pause. */
95 #define pause_not_cancel() \
96 __pause_nocancel ()
98 /* Uncancelable nanosleep. */
99 #define nanosleep_not_cancel(requested_time, remaining) \
100 __nanosleep_nocancel (requested_time, remaining)
102 /* Uncancelable sigsuspend. */
103 #define sigsuspend_not_cancel(set) \
104 __sigsuspend_nocancel (set)