| 1 | /* Get file status. Linux/MIPSn64 version. |
| 2 | Copyright (C) 2022-2024 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #include <sys/stat.h> |
| 20 | #include <sysdep.h> |
| 21 | |
| 22 | /* Different than other ABIs, mips64 has different layouts for non-LFS |
| 23 | and LFS struct stat. */ |
| 24 | int |
| 25 | __fstatat (int fd, const char *file, struct stat *buf, int flag) |
| 26 | { |
| 27 | struct __stat64_t64 st64; |
| 28 | int r = __fstatat64_time64 (fd, file, &st64, flag); |
| 29 | if (r == 0) |
| 30 | { |
| 31 | /* Clear internal pad and reserved fields. */ |
| 32 | memset (buf, 0, sizeof (*buf)); |
| 33 | |
| 34 | buf->st_dev = st64.st_dev; |
| 35 | buf->st_ino = st64.st_ino; |
| 36 | buf->st_mode = st64.st_mode; |
| 37 | buf->st_nlink = st64.st_nlink; |
| 38 | buf->st_uid = st64.st_uid; |
| 39 | buf->st_gid = st64.st_gid; |
| 40 | buf->st_rdev = st64.st_rdev; |
| 41 | buf->st_size = st64.st_size; |
| 42 | buf->st_blksize = st64.st_blksize; |
| 43 | buf->st_blocks = st64.st_blocks; |
| 44 | buf->st_atim = st64.st_atim; |
| 45 | buf->st_mtim = st64.st_mtim; |
| 46 | buf->st_ctim = st64.st_ctim; |
| 47 | } |
| 48 | return r; |
| 49 | } |
| 50 | |
| 51 | weak_alias (__fstatat, fstatat) |
| 52 | |