statx.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* Generic statx-related definitions and declarations.
  2. Copyright (C) 2018-2019 Free Software Foundation, Inc.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. /* This interface is based on <linux/stat.h> in Linux. */
  15. #ifndef _SYS_STAT_H
  16. # error Never include <bits/statx.h> directly, include <sys/stat.h> instead.
  17. #endif
  18. struct statx_timestamp
  19. {
  20. __int64_t tv_sec;
  21. __uint32_t tv_nsec;
  22. __int32_t __statx_timestamp_pad1[1];
  23. };
  24. /* Warning: The kernel may add additional fields to this struct in the
  25. future. Only use this struct for calling the statx function, not
  26. for storing data. (Expansion will be controlled by the mask
  27. argument of the statx function.) */
  28. struct statx
  29. {
  30. __uint32_t stx_mask;
  31. __uint32_t stx_blksize;
  32. __uint64_t stx_attributes;
  33. __uint32_t stx_nlink;
  34. __uint32_t stx_uid;
  35. __uint32_t stx_gid;
  36. __uint16_t stx_mode;
  37. __uint16_t __statx_pad1[1];
  38. __uint64_t stx_ino;
  39. __uint64_t stx_size;
  40. __uint64_t stx_blocks;
  41. __uint64_t stx_attributes_mask;
  42. struct statx_timestamp stx_atime;
  43. struct statx_timestamp stx_btime;
  44. struct statx_timestamp stx_ctime;
  45. struct statx_timestamp stx_mtime;
  46. __uint32_t stx_rdev_major;
  47. __uint32_t stx_rdev_minor;
  48. __uint32_t stx_dev_major;
  49. __uint32_t stx_dev_minor;
  50. __uint64_t __statx_pad2[14];
  51. };
  52. #ifndef STATX_TYPE
  53. # define STATX_TYPE 0x0001U
  54. # define STATX_MODE 0x0002U
  55. # define STATX_NLINK 0x0004U
  56. # define STATX_UID 0x0008U
  57. # define STATX_GID 0x0010U
  58. # define STATX_ATIME 0x0020U
  59. # define STATX_MTIME 0x0040U
  60. # define STATX_CTIME 0x0080U
  61. # define STATX_INO 0x0100U
  62. # define STATX_SIZE 0x0200U
  63. # define STATX_BLOCKS 0x0400U
  64. # define STATX_BASIC_STATS 0x07ffU
  65. # define STATX_ALL 0x0fffU
  66. # define STATX_BTIME 0x0800U
  67. # define STATX__RESERVED 0x80000000U
  68. # define STATX_ATTR_COMPRESSED 0x0004
  69. # define STATX_ATTR_IMMUTABLE 0x0010
  70. # define STATX_ATTR_APPEND 0x0020
  71. # define STATX_ATTR_NODUMP 0x0040
  72. # define STATX_ATTR_ENCRYPTED 0x0800
  73. # define STATX_ATTR_AUTOMOUNT 0x1000
  74. #endif /* !STATX_TYPE */
  75. __BEGIN_DECLS
  76. /* Fill *BUF with information about PATH in DIRFD. */
  77. int statx (int __dirfd, const char *__restrict __path, int __flags,
  78. unsigned int __mask, struct statx *__restrict __buf)
  79. __THROW __nonnull ((2, 5));
  80. __END_DECLS