yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * fstatat64() 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 | #include <sys/syscall.h> |
| 10 | #include <sys/stat.h> |
| 11 | #include "xstatconv.h" |
| 12 | |
| 13 | #ifdef __UCLIBC_HAS_LFS__ |
| 14 | |
| 15 | /* 64bit ports tend to favor newfstatat() */ |
| 16 | #ifdef __NR_newfstatat |
| 17 | # define __NR_fstatat64 __NR_newfstatat |
| 18 | #endif |
| 19 | |
| 20 | #ifdef __NR_fstatat64 |
| 21 | int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) |
| 22 | { |
| 23 | int ret; |
| 24 | struct kernel_stat64 kbuf; |
| 25 | |
| 26 | ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag); |
| 27 | if (ret == 0) |
| 28 | __xstat64_conv(&kbuf, buf); |
| 29 | |
| 30 | return ret; |
| 31 | } |
| 32 | #else |
| 33 | /* should add emulation with fstat64() and /proc/self/fd/ ... */ |
| 34 | #endif |
| 35 | |
| 36 | #endif |