]>
Commit | Line | Data |
---|---|---|
2fbdf533 | 1 | /* Uncancelable versions of cancelable interfaces. Linux/NPTL version. |
d4697bc9 | 2 | Copyright (C) 2003-2014 Free Software Foundation, Inc. |
2c008571 UD |
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 | |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
2c008571 UD |
19 | |
20 | #include <sysdep.h> | |
21 | ||
683040c3 | 22 | #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt |
2fbdf533 RM |
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; | |
683040c3 | 28 | extern int __openat_nocancel (int fd, const char *fname, int oflag, |
d369ad76 | 29 | mode_t mode) attribute_hidden; |
2fbdf533 RM |
30 | extern int __openat64_nocancel (int fd, const char *fname, int oflag, |
31 | mode_t mode) attribute_hidden; | |
683040c3 | 32 | #else |
2fbdf533 RM |
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) | |
683040c3 UD |
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 | |
44 | ||
2fbdf533 RM |
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) | |
50 | ||
51 | /* Uncancelable openat. */ | |
d369ad76 | 52 | #define openat_not_cancel(fd, fname, oflag, mode) \ |
683040c3 | 53 | __openat_nocancel (fd, fname, oflag, mode) |
d369ad76 | 54 | #define openat_not_cancel_3(fd, fname, oflag) \ |
683040c3 | 55 | __openat_nocancel (fd, fname, oflag, 0) |
d369ad76 | 56 | #define openat64_not_cancel(fd, fname, oflag, mode) \ |
683040c3 | 57 | __openat64_nocancel (fd, fname, oflag, mode) |
d369ad76 | 58 | #define openat64_not_cancel_3(fd, fname, oflag) \ |
683040c3 | 59 | __openat64_nocancel (fd, fname, oflag, 0) |
d369ad76 | 60 | |
2c008571 | 61 | /* Uncancelable close. */ |
73299943 | 62 | #define close_not_cancel(fd) \ |
2fbdf533 | 63 | __close_nocancel (fd) |
73299943 | 64 | #define close_not_cancel_no_status(fd) \ |
2c008571 | 65 | (void) ({ INTERNAL_SYSCALL_DECL (err); \ |
f478103f | 66 | INTERNAL_SYSCALL (close, err, 1, (fd)); }) |
2c008571 UD |
67 | |
68 | /* Uncancelable read. */ | |
73299943 | 69 | #define read_not_cancel(fd, buf, n) \ |
2fbdf533 | 70 | __read_nocancel (fd, buf, n) |
2c008571 UD |
71 | |
72 | /* Uncancelable write. */ | |
73299943 | 73 | #define write_not_cancel(fd, buf, n) \ |
2fbdf533 | 74 | __write_nocancel (fd, buf, n) |
2c008571 UD |
75 | |
76 | /* Uncancelable writev. */ | |
73299943 | 77 | #define writev_not_cancel_no_status(fd, iov, n) \ |
2c008571 | 78 | (void) ({ INTERNAL_SYSCALL_DECL (err); \ |
f478103f | 79 | INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); }) |
73299943 | 80 | |
ce42435c UD |
81 | /* Uncancelable fcntl. */ |
82 | #define fcntl_not_cancel(fd, cmd, val) \ | |
83 | __fcntl_nocancel (fd, cmd, val) | |
84 | ||
73299943 | 85 | /* Uncancelable waitpid. */ |
f75616b2 | 86 | #define waitpid_not_cancel(pid, stat_loc, options) \ |
73299943 | 87 | INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) |
b894c2ea RM |
88 | |
89 | /* Uncancelable pause. */ | |
2fbdf533 | 90 | #define pause_not_cancel() \ |
b894c2ea | 91 | __pause_nocancel () |
b894c2ea RM |
92 | |
93 | /* Uncancelable nanosleep. */ | |
2fbdf533 | 94 | #define nanosleep_not_cancel(requested_time, remaining) \ |
b894c2ea | 95 | __nanosleep_nocancel (requested_time, remaining) |
b894c2ea RM |
96 | |
97 | /* Uncancelable sigsuspend. */ | |
98 | #define sigsuspend_not_cancel(set) \ | |
99 | __sigsuspend_nocancel (set) |