yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * openat() for uClibc |
| 3 | * |
| 4 | * Copyright (C) 2009 Analog Devices Inc. |
| 5 | * |
| 6 | * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 7 | */ |
| 8 | |
| 9 | #define openat64 __xx_openat |
| 10 | #include <sys/syscall.h> |
| 11 | #include <fcntl.h> |
| 12 | #undef openat64 |
| 13 | |
| 14 | #ifdef __UCLIBC_HAS_LFS__ |
| 15 | |
| 16 | #ifdef __NR_openat |
| 17 | /* The openat() prototype is varargs based, but we don't care about that |
| 18 | * here, so need to provide our own dedicated signature. |
| 19 | */ |
| 20 | extern int openat64(int fd, const char *file, int oflag, mode_t mode); |
| 21 | libc_hidden_proto(openat64) |
| 22 | |
| 23 | int openat64(int fd, const char *file, int oflag, mode_t mode) |
| 24 | { |
| 25 | return openat(fd, file, oflag | O_LARGEFILE, mode); |
| 26 | } |
| 27 | libc_hidden_def(openat64) |
| 28 | #else |
| 29 | /* should add emulation with open() and /proc/self/fd/ ... */ |
| 30 | #endif |
| 31 | |
| 32 | #endif |