]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/not-cancel.h
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / not-cancel.h
CommitLineData
2c008571 1/* Uncancelable versions of cancelable interfaces. Linux 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 19
d369ad76 20#include <sys/types.h>
2c008571
UD
21#include <sysdep.h>
22
23/* Uncancelable open. */
73299943 24#define open_not_cancel(name, flags, mode) \
f478103f 25 INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode))
73299943
UD
26#define open_not_cancel_2(name, flags) \
27 INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
2c008571 28
d369ad76 29/* Uncancelable openat. */
683040c3
UD
30#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
31extern int __openat_nocancel (int fd, const char *fname, int oflag,
32 mode_t mode) attribute_hidden;
33extern int __openat64_nocancel (int fd, const char *fname, int oflag,
d369ad76 34 mode_t mode) attribute_hidden;
683040c3
UD
35#else
36# define __openat_nocancel(fd, fname, oflag, mode) \
37 openat (fd, fname, oflag, mode)
38# define __openat64_nocancel(fd, fname, oflag, mode) \
39 openat64 (fd, fname, oflag, mode)
40#endif
41
d369ad76 42#define openat_not_cancel(fd, fname, oflag, mode) \
683040c3 43 __openat_nocancel (fd, fname, oflag, mode)
d369ad76 44#define openat_not_cancel_3(fd, fname, oflag) \
683040c3 45 __openat_nocancel (fd, fname, oflag, 0)
d369ad76 46#define openat64_not_cancel(fd, fname, oflag, mode) \
683040c3 47 __openat64_nocancel (fd, fname, oflag, mode)
d369ad76 48#define openat64_not_cancel_3(fd, fname, oflag) \
683040c3 49 __openat64_nocancel (fd, fname, oflag, 0)
d369ad76 50
2c008571 51/* Uncancelable close. */
73299943
UD
52#define close_not_cancel(fd) \
53 INLINE_SYSCALL (close, 1, fd)
54#define close_not_cancel_no_status(fd) \
2c008571 55 (void) ({ INTERNAL_SYSCALL_DECL (err); \
f478103f 56 INTERNAL_SYSCALL (close, err, 1, (fd)); })
2c008571
UD
57
58/* Uncancelable read. */
73299943 59#define read_not_cancel(fd, buf, n) \
f478103f 60 INLINE_SYSCALL (read, 3, (fd), (buf), (n))
2c008571
UD
61
62/* Uncancelable write. */
73299943 63#define write_not_cancel(fd, buf, n) \
f478103f 64 INLINE_SYSCALL (write, 3, (fd), (buf), (n))
2c008571
UD
65
66/* Uncancelable writev. */
73299943 67#define writev_not_cancel_no_status(fd, iov, n) \
2c008571 68 (void) ({ INTERNAL_SYSCALL_DECL (err); \
f478103f 69 INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); })
73299943 70
ce42435c
UD
71/* Uncancelable fcntl. */
72#define fcntl_not_cancel(fd, cmd, val) \
73 __fcntl_nocancel (fd, cmd, val)
74
73299943
UD
75/* Uncancelable waitpid. */
76#ifdef __NR_waitpid
77# define waitpid_not_cancel(pid, stat_loc, options) \
78 INLINE_SYSCALL (waitpid, 3, pid, stat_loc, options)
79#else
80# define waitpid_not_cancel(pid, stat_loc, options) \
81 INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
2c008571 82#endif
b894c2ea
RM
83
84/* Uncancelable pause. */
85#ifdef __NR_pause
86# define pause_not_cancel() \
87 INLINE_SYSCALL (pause, 0)
88#else
89# define pause_not_cancel() \
90 __pause_nocancel ()
91#endif
92
93/* Uncancelable nanosleep. */
94#ifdef __NR_nanosleep
95# define nanosleep_not_cancel(requested_time, remaining) \
96 INLINE_SYSCALL (nanosleep, 2, requested_time, remaining)
97#else
98# define nanosleep_not_cancel(requested_time, remaining) \
99 __nanosleep_nocancel (requested_time, remaining)
100#endif
101
102/* Uncancelable sigsuspend. */
103#define sigsuspend_not_cancel(set) \
104 __sigsuspend_nocancel (set)