struct_stat_time64_helper.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Definition for helper to define struct stat with 64-bit time.
  2. Copyright (C) 2021-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  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.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library. If not, see
  14. <https://www.gnu.org/licenses/>. */
  15. /* Content of internal __stat64_t64 struct. */
  16. __dev_t st_dev; /* Device. */
  17. __ino64_t st_ino; /* file serial number. */
  18. __mode_t st_mode; /* File mode. */
  19. __nlink_t st_nlink; /* Link count. */
  20. __uid_t st_uid; /* User ID of the file's owner. */
  21. __gid_t st_gid; /* Group ID of the file's group. */
  22. __dev_t st_rdev; /* Device number, if device. */
  23. __off64_t st_size; /* Size of file, in bytes. */
  24. __blksize_t st_blksize; /* Optimal block size for I/O. */
  25. __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
  26. #ifdef __USE_XOPEN2K8
  27. # ifndef __struct_timespec
  28. # define __struct_timespec struct timespec
  29. # endif
  30. /* Nanosecond resolution timestamps are stored in a format
  31. equivalent to 'struct timespec'. This is the type used
  32. whenever possible but the Unix namespace rules do not allow the
  33. identifier 'timespec' to appear in the <sys/stat.h> header.
  34. Therefore we have to handle the use of this header in strictly
  35. standard-compliant sources special. */
  36. __struct_timespec st_atim;
  37. __struct_timespec st_mtim;
  38. __struct_timespec st_ctim;
  39. # define st_atime st_atim.tv_sec
  40. # define st_mtime st_mtim.tv_sec
  41. # define st_ctime st_ctim.tv_sec
  42. # undef __struct_timespec
  43. #else
  44. /* The definition should be equal to the 'struct __timespec64' internal
  45. layout. */
  46. # if __BYTE_ORDER == __BIG_ENDIAN
  47. # define __fieldts64(name) \
  48. __time64_t name; __int32_t :32; __int32_t name ## nsec
  49. # else
  50. # define __fieldts64(name) \
  51. __time64_t name; __int32_t name ## nsec; __int32_t :32
  52. # endif
  53. __fieldts64 (st_atime);
  54. __fieldts64 (st_mtime);
  55. __fieldts64 (st_ctime);
  56. unsigned long int __glibc_reserved4;
  57. unsigned long int __glibc_reserved5;
  58. # undef __fieldts64
  59. #endif