Fix some uses of ret in libpthread
[glibc/nacl-glibc.git] / nptl / sysdeps / unix / sysv / linux / i386 / not-cancel.h
blob6557359b4387f1919226aa824a9712da5c5fc394
1 /* Uncancelable versions of cancelable interfaces. Linux/NPTL version.
2 Copyright (C) 2003, 2006 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, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #include <sysdep.h>
23 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
24 extern int __open_nocancel (const char *, int, ...) attribute_hidden;
25 extern int __close_nocancel (int) attribute_hidden;
26 extern int __read_nocancel (int, void *, size_t) attribute_hidden;
27 extern int __write_nocancel (int, const void *, size_t) attribute_hidden;
28 extern pid_t __waitpid_nocancel (pid_t, int *, int) attribute_hidden;
29 extern int __openat_nocancel (int fd, const char *fname, int oflag,
30 mode_t mode) attribute_hidden;
31 extern int __openat64_nocancel (int fd, const char *fname, int oflag,
32 mode_t mode) attribute_hidden;
33 #else
34 # define __open_nocancel(name, ...) __open (name, __VA_ARGS__)
35 # define __close_nocancel(fd) __close (fd)
36 # define __read_nocancel(fd, buf, len) __read (fd, buf, len)
37 # define __write_nocancel(fd, buf, len) __write (fd, buf, len)
38 # define __waitpid_nocancel(pid, stat_loc, options) \
39 __waitpid (pid, stat_loc, options)
40 # define __openat_nocancel(fd, fname, oflag, mode) \
41 openat (fd, fname, oflag, mode)
42 # define __openat64_nocancel(fd, fname, oflag, mode) \
43 openat64 (fd, fname, oflag, mode)
44 #endif
46 /* Uncancelable open. */
47 #define open_not_cancel(name, flags, mode) \
48 __open_nocancel (name, flags, mode)
49 #define open_not_cancel_2(name, flags) \
50 __open_nocancel (name, flags)
52 /* Uncancelable openat. */
53 #define openat_not_cancel(fd, fname, oflag, mode) \
54 __openat_nocancel (fd, fname, oflag, mode)
55 #define openat_not_cancel_3(fd, fname, oflag) \
56 __openat_nocancel (fd, fname, oflag, 0)
57 #define openat64_not_cancel(fd, fname, oflag, mode) \
58 __openat64_nocancel (fd, fname, oflag, mode)
59 #define openat64_not_cancel_3(fd, fname, oflag) \
60 __openat64_nocancel (fd, fname, oflag, 0)
62 /* Uncancelable close. */
63 #define close_not_cancel(fd) \
64 __close_nocancel (fd)
65 #define close_not_cancel_no_status(fd) \
66 (void) ({ INTERNAL_SYSCALL_DECL (err); \
67 INTERNAL_SYSCALL (close, err, 1, (fd)); })
69 /* Uncancelable read. */
70 #define read_not_cancel(fd, buf, n) \
71 __read_nocancel (fd, buf, n)
73 /* Uncancelable write. */
74 #define write_not_cancel(fd, buf, n) \
75 __write_nocancel (fd, buf, n)
77 /* Uncancelable writev. */
78 #define writev_not_cancel_no_status(fd, iov, n) \
79 (void) ({ INTERNAL_SYSCALL_DECL (err); \
80 INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); })
82 /* Uncancelable fcntl. */
83 #define fcntl_not_cancel(fd, cmd, val) \
84 __fcntl_nocancel (fd, cmd, val)
86 /* Uncancelable waitpid. */
87 #ifdef __NR_waitpid
88 # define waitpid_not_cancel(pid, stat_loc, options) \
89 __waitpid_nocancel (pid, stat_loc, options)
90 #else
91 # define waitpid_not_cancel(pid, stat_loc, options) \
92 INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
93 #endif
95 /* Uncancelable pause. */
96 #define pause_not_cancel() \
97 __pause_nocancel ()
99 /* Uncancelable nanosleep. */
100 #define nanosleep_not_cancel(requested_time, remaining) \
101 __nanosleep_nocancel (requested_time, remaining)
103 /* Uncancelable sigsuspend. */
104 #define sigsuspend_not_cancel(set) \
105 __sigsuspend_nocancel (set)