]>
Commit | Line | Data |
---|---|---|
688903eb | 1 | /* Copyright (C) 1991-2018 Free Software Foundation, Inc. |
478b92f0 | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
478b92f0 | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
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. | |
28f540f4 | 8 | |
478b92f0 UD |
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 | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
28f540f4 | 17 | |
dfd2257a UD |
18 | #include <fcntl.h> |
19 | #include <stdarg.h> | |
6ee8d334 | 20 | #include <sysdep-cancel.h> |
28f540f4 | 21 | |
65f6f938 | 22 | /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, |
dfd2257a | 23 | a third argument is the file protection. */ |
28f540f4 | 24 | int |
778c59c8 | 25 | __libc_open64 (const char *file, int oflag, ...) |
28f540f4 | 26 | { |
778c59c8 | 27 | int mode = 0; |
dfd2257a | 28 | |
65f6f938 | 29 | if (__OPEN_NEEDS_MODE (oflag)) |
28f540f4 | 30 | { |
dfd2257a UD |
31 | va_list arg; |
32 | va_start (arg, oflag); | |
33 | mode = va_arg (arg, int); | |
34 | va_end (arg); | |
28f540f4 RM |
35 | } |
36 | ||
6ee8d334 UD |
37 | if (SINGLE_THREAD_P) |
38 | return __libc_open (file, oflag | O_LARGEFILE, mode); | |
39 | ||
40 | int oldtype = LIBC_CANCEL_ASYNC (); | |
41 | ||
42 | int result = __libc_open (file, oflag | O_LARGEFILE, mode); | |
43 | ||
44 | LIBC_CANCEL_RESET (oldtype); | |
45 | ||
46 | return result; | |
28f540f4 | 47 | } |
e97ed6dd JM |
48 | weak_alias (__libc_open64, __open64) |
49 | libc_hidden_weak (__open64) | |
50 | weak_alias (__libc_open64, open64) |