1 /* Copyright (C) 2005-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
25 #include <sysdep-cancel.h>
26 #include <not-cancel.h>
30 # define OPENAT openat
34 #define OPENAT_NOT_CANCEL CONCAT (OPENAT)
35 #define CONCAT(name) CONCAT2 (name)
36 #define CONCAT2(name) __##name##_nocancel
40 OPENAT_NOT_CANCEL (fd
, file
, oflag
, mode
)
47 /* We have to add the O_LARGEFILE flag for openat64. */
52 return INLINE_SYSCALL (openat
, 4, fd
, file
, oflag
, mode
);
55 #define UNDERIZE(name) UNDERIZE_1 (name)
56 #define UNDERIZE_1(name) __##name
57 #define __OPENAT UNDERIZE (OPENAT)
60 /* Open FILE with access OFLAG. Interpret relative paths relative to
61 the directory associated with FD. If OFLAG includes O_CREAT, a
62 third argument is the file protection. */
64 __OPENAT (fd
, file
, oflag
)
73 va_start (arg
, oflag
);
74 mode
= va_arg (arg
, mode_t
);
79 return OPENAT_NOT_CANCEL (fd
, file
, oflag
, mode
);
81 int oldtype
= LIBC_CANCEL_ASYNC ();
83 int res
= OPENAT_NOT_CANCEL (fd
, file
, oflag
, mode
);
85 LIBC_CANCEL_RESET (oldtype
);
89 libc_hidden_def (__OPENAT
)
90 weak_alias (__OPENAT
, OPENAT
)