stat.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #ifndef _SYS_STAT_H
  2. #define _SYS_STAT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #define __NEED_dev_t
  8. #define __NEED_ino_t
  9. #define __NEED_mode_t
  10. #define __NEED_nlink_t
  11. #define __NEED_uid_t
  12. #define __NEED_gid_t
  13. #define __NEED_off_t
  14. #define __NEED_time_t
  15. #define __NEED_blksize_t
  16. #define __NEED_blkcnt_t
  17. #define __NEED_struct_timespec
  18. #include <bits/alltypes.h>
  19. #include <bits/stat.h>
  20. #define st_atime st_atim.tv_sec
  21. #define st_mtime st_mtim.tv_sec
  22. #define st_ctime st_ctim.tv_sec
  23. #define S_IFMT 0170000
  24. #define S_IFDIR 0040000
  25. #define S_IFCHR 0020000
  26. #define S_IFBLK 0060000
  27. #define S_IFREG 0100000
  28. #define S_IFIFO 0010000
  29. #define S_IFLNK 0120000
  30. #define S_IFSOCK 0140000
  31. #define S_TYPEISMQ(buf) 0
  32. #define S_TYPEISSEM(buf) 0
  33. #define S_TYPEISSHM(buf) 0
  34. #define S_TYPEISTMO(buf) 0
  35. #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
  36. #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
  37. #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
  38. #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
  39. #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
  40. #define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
  41. #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
  42. #ifndef S_IRUSR
  43. #define S_ISUID 04000
  44. #define S_ISGID 02000
  45. #define S_ISVTX 01000
  46. #define S_IRUSR 0400
  47. #define S_IWUSR 0200
  48. #define S_IXUSR 0100
  49. #define S_IRWXU 0700
  50. #define S_IRGRP 0040
  51. #define S_IWGRP 0020
  52. #define S_IXGRP 0010
  53. #define S_IRWXG 0070
  54. #define S_IROTH 0004
  55. #define S_IWOTH 0002
  56. #define S_IXOTH 0001
  57. #define S_IRWXO 0007
  58. #endif
  59. #define UTIME_NOW 0x3fffffff
  60. #define UTIME_OMIT 0x3ffffffe
  61. int stat(const char *__restrict, struct stat *__restrict);
  62. int fstat(int, struct stat *);
  63. int lstat(const char *__restrict, struct stat *__restrict);
  64. int fstatat(int, const char *__restrict, struct stat *__restrict, int);
  65. int chmod(const char *, mode_t);
  66. int fchmod(int, mode_t);
  67. int fchmodat(int, const char *, mode_t, int);
  68. mode_t umask(mode_t);
  69. int mkdir(const char *, mode_t);
  70. int mknod(const char *, mode_t, dev_t);
  71. int mkfifo(const char *, mode_t);
  72. int mkdirat(int, const char *, mode_t);
  73. int mknodat(int, const char *, mode_t, dev_t);
  74. int mkfifoat(int, const char *, mode_t);
  75. int futimens(int, const struct timespec [2]);
  76. int utimensat(int, const char *, const struct timespec [2], int);
  77. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  78. int lchmod(const char *, mode_t);
  79. #define S_IREAD S_IRUSR
  80. #define S_IWRITE S_IWUSR
  81. #define S_IEXEC S_IXUSR
  82. #endif
  83. #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
  84. #define stat64 stat
  85. #define fstat64 fstat
  86. #define lstat64 lstat
  87. #define fstatat64 fstatat
  88. #define blkcnt64_t blkcnt_t
  89. #define fsblkcnt64_t fsblkcnt_t
  90. #define fsfilcnt64_t fsfilcnt_t
  91. #define ino64_t ino_t
  92. #define off64_t off_t
  93. #endif
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97. #endif