1 /* Definition for helper to define struct stat with 64-bit time. 2 Copyright (C) 2021 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 /* Content of internal __stat64_t64 struct. */ 20 __dev_t st_dev; /* Device. */ 21 __ino64_t st_ino; /* file serial number. */ 22 __mode_t st_mode; /* File mode. */ 23 __nlink_t st_nlink; /* Link count. */ 24 __uid_t st_uid; /* User ID of the file's owner. */ 25 __gid_t st_gid; /* Group ID of the file's group. */ 26 __dev_t st_rdev; /* Device number, if device. */ 27 __off64_t st_size; /* Size of file, in bytes. */ 28 __blksize_t st_blksize; /* Optimal block size for I/O. */ 29 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ 30 #ifdef __USE_XOPEN2K8 31 # ifndef __struct_timespec 32 # define __struct_timespec struct timespec 33 # endif 34 /* Nanosecond resolution timestamps are stored in a format 35 equivalent to 'struct timespec'. This is the type used 36 whenever possible but the Unix namespace rules do not allow the 37 identifier 'timespec' to appear in the <sys/stat.h> header. 38 Therefore we have to handle the use of this header in strictly 39 standard-compliant sources special. */ 40 __struct_timespec st_atim; 41 __struct_timespec st_mtim; 42 __struct_timespec st_ctim; 43 # define st_atime st_atim.tv_sec 44 # define st_mtime st_mtim.tv_sec 45 # define st_ctime st_ctim.tv_sec 46 # undef __struct_timespec 47 #else 48 /* The definition should be equal to the 'struct __timespec64' internal 49 layout. */ 50 # if __BYTE_ORDER == __BIG_ENDIAN 51 # define __fieldts64(name) \ 52 __time64_t name; __int32_t :32; __int32_t name ## nsec 53 # else 54 # define __fieldts64(name) \ 55 __time64_t name; __int32_t name ## nsec; __int32_t :32 56 # endif 57 58 __fieldts64 (st_atime); 59 __fieldts64 (st_mtime); 60 __fieldts64 (st_ctime); 61 62 unsigned long int __glibc_reserved4; 63 unsigned long int __glibc_reserved5; 64 65 # undef __fieldts64 66 #endif 67