stat.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Copyright (C) 1992-2019 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  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. <http://www.gnu.org/licenses/>. */
  14. #if !defined _SYS_STAT_H && !defined _FCNTL_H
  15. # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
  16. #endif
  17. #ifndef _BITS_STAT_H
  18. #define _BITS_STAT_H 1
  19. /* This structure needs to be defined in accordance with the
  20. implementation of __stat, __fstat, and __lstat. */
  21. #include <bits/types.h>
  22. /* Structure describing file characteristics. */
  23. struct stat
  24. {
  25. /* These are the members that POSIX.1 requires. */
  26. __mode_t st_mode; /* File mode. */
  27. #ifndef __USE_FILE_OFFSET64
  28. __ino_t st_ino; /* File serial number. */
  29. #else
  30. __ino64_t st_ino; /* File serial number. */
  31. #endif
  32. __dev_t st_dev; /* Device containing the file. */
  33. __nlink_t st_nlink; /* Link count. */
  34. __uid_t st_uid; /* User ID of the file's owner. */
  35. __gid_t st_gid; /* Group ID of the file's group. */
  36. #ifndef __USE_FILE_OFFSET64
  37. __off_t st_size; /* Size of file, in bytes. */
  38. #else
  39. __off64_t st_size; /* Size of file, in bytes. */
  40. #endif
  41. __time_t st_atime; /* Time of last access. */
  42. __time_t st_mtime; /* Time of last modification. */
  43. __time_t st_ctime; /* Time of last status change. */
  44. /* This should be defined if there is a `st_blksize' member. */
  45. #undef _STATBUF_ST_BLKSIZE
  46. };
  47. /* Encoding of the file mode. These are the standard Unix values,
  48. but POSIX.1 does not specify what values should be used. */
  49. #define __S_IFMT 0170000 /* These bits determine file type. */
  50. /* File types. */
  51. #define __S_IFDIR 0040000 /* Directory. */
  52. #define __S_IFCHR 0020000 /* Character device. */
  53. #define __S_IFBLK 0060000 /* Block device. */
  54. #define __S_IFREG 0100000 /* Regular file. */
  55. #define __S_IFIFO 0010000 /* FIFO. */
  56. /* POSIX.1b objects. */
  57. #define __S_TYPEISMQ(buf) 0
  58. #define __S_TYPEISSEM(buf) 0
  59. #define __S_TYPEISSHM(buf) 0
  60. /* Protection bits. */
  61. #define __S_ISUID 04000 /* Set user ID on execution. */
  62. #define __S_ISGID 02000 /* Set group ID on execution. */
  63. #define __S_IREAD 0400 /* Read by owner. */
  64. #define __S_IWRITE 0200 /* Write by owner. */
  65. #define __S_IEXEC 0100 /* Execute by owner. */
  66. #ifdef __USE_LARGEFILE64
  67. struct stat64
  68. {
  69. __mode_t st_mode; /* File mode. */
  70. __ino64_t st_ino; /* File serial number. */
  71. __dev_t st_dev; /* Device. */
  72. __nlink_t st_nlink; /* Link count. */
  73. __uid_t st_uid; /* User ID of the file's owner. */
  74. __gid_t st_gid; /* Group ID of the file's group.*/
  75. __off64_t st_size; /* Size of file, in bytes. */
  76. __time_t st_atime; /* Time of last access. */
  77. __time_t st_mtime; /* Time of last modification. */
  78. __time_t st_ctime; /* Time of last status change. */
  79. };
  80. #endif
  81. #endif /* bits/stat.h */