Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #ifndef _SYS_STAT_H
  2. #define _SYS_STAT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <_ansi.h>
  7. #include <time.h>
  8. #include <sys/cdefs.h>
  9. #include <sys/types.h>
  10. #include <sys/_timespec.h>
  11. /* dj's stat defines _STAT_H_ */
  12. #ifndef _STAT_H_
  13. /* It is intended that the layout of this structure not change when the
  14. sizes of any of the basic types change (short, int, long) [via a compile
  15. time option]. */
  16. #ifdef __CYGWIN__
  17. #include <cygwin/stat.h>
  18. #ifdef _COMPILING_NEWLIB
  19. #define stat64 stat
  20. #endif
  21. #else
  22. struct stat
  23. {
  24. dev_t st_dev;
  25. ino_t st_ino;
  26. mode_t st_mode;
  27. nlink_t st_nlink;
  28. uid_t st_uid;
  29. gid_t st_gid;
  30. dev_t st_rdev;
  31. off_t st_size;
  32. #if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
  33. time_t st_atime;
  34. time_t st_mtime;
  35. time_t st_ctime;
  36. #else
  37. struct timespec st_atim;
  38. struct timespec st_mtim;
  39. struct timespec st_ctim;
  40. blksize_t st_blksize;
  41. blkcnt_t st_blocks;
  42. #if !defined(__rtems__)
  43. long st_spare4[2];
  44. #endif
  45. #endif
  46. };
  47. #if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)) && !defined(__cris__)
  48. #define st_atime st_atim.tv_sec
  49. #define st_ctime st_ctim.tv_sec
  50. #define st_mtime st_mtim.tv_sec
  51. #endif
  52. #endif
  53. #define _IFMT 0170000 /* type of file */
  54. #define _IFDIR 0040000 /* directory */
  55. #define _IFCHR 0020000 /* character special */
  56. #define _IFBLK 0060000 /* block special */
  57. #define _IFREG 0100000 /* regular */
  58. #define _IFLNK 0120000 /* symbolic link */
  59. #define _IFSOCK 0140000 /* socket */
  60. #define _IFIFO 0010000 /* fifo */
  61. #define S_BLKSIZE 1024 /* size of a block */
  62. #define S_ISUID 0004000 /* set user id on execution */
  63. #define S_ISGID 0002000 /* set group id on execution */
  64. #define S_ISVTX 0001000 /* save swapped text even after use */
  65. #if __BSD_VISIBLE
  66. #define S_IREAD 0000400 /* read permission, owner */
  67. #define S_IWRITE 0000200 /* write permission, owner */
  68. #define S_IEXEC 0000100 /* execute/search permission, owner */
  69. #define S_ENFMT 0002000 /* enforcement-mode locking */
  70. #endif /* !_BSD_VISIBLE */
  71. #define S_IFMT _IFMT
  72. #define S_IFDIR _IFDIR
  73. #define S_IFCHR _IFCHR
  74. #define S_IFBLK _IFBLK
  75. #define S_IFREG _IFREG
  76. #define S_IFLNK _IFLNK
  77. #define S_IFSOCK _IFSOCK
  78. #define S_IFIFO _IFIFO
  79. #ifdef _WIN32
  80. /* The Windows header files define _S_ forms of these, so we do too
  81. for easier portability. */
  82. #define _S_IFMT _IFMT
  83. #define _S_IFDIR _IFDIR
  84. #define _S_IFCHR _IFCHR
  85. #define _S_IFIFO _IFIFO
  86. #define _S_IFREG _IFREG
  87. #define _S_IREAD 0000400
  88. #define _S_IWRITE 0000200
  89. #define _S_IEXEC 0000100
  90. #endif
  91. #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
  92. #define S_IRUSR 0000400 /* read permission, owner */
  93. #define S_IWUSR 0000200 /* write permission, owner */
  94. #define S_IXUSR 0000100/* execute/search permission, owner */
  95. #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
  96. #define S_IRGRP 0000040 /* read permission, group */
  97. #define S_IWGRP 0000020 /* write permission, grougroup */
  98. #define S_IXGRP 0000010/* execute/search permission, group */
  99. #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
  100. #define S_IROTH 0000004 /* read permission, other */
  101. #define S_IWOTH 0000002 /* write permission, other */
  102. #define S_IXOTH 0000001/* execute/search permission, other */
  103. #if __BSD_VISIBLE
  104. #define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */
  105. #define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */
  106. #define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */
  107. #endif
  108. #define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
  109. #define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
  110. #define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
  111. #define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
  112. #define S_ISREG(m) (((m)&_IFMT) == _IFREG)
  113. #define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
  114. #define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
  115. #if defined(__CYGWIN__)
  116. /* Special tv_nsec values for futimens(2) and utimensat(2). */
  117. #define UTIME_NOW -2L
  118. #define UTIME_OMIT -1L
  119. #endif
  120. int chmod (const char *__path, mode_t __mode );
  121. int fchmod (int __fd, mode_t __mode);
  122. int fstat (int __fd, struct stat *__sbuf );
  123. int mkdir (const char *_path, mode_t __mode );
  124. int mkfifo (const char *__path, mode_t __mode );
  125. int stat (const char *__restrict __path, struct stat *__restrict __sbuf );
  126. mode_t umask (mode_t __mask );
  127. #if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
  128. int lstat (const char *__restrict __path, struct stat *__restrict __buf );
  129. int mknod (const char *__path, mode_t __mode, dev_t __dev );
  130. #endif
  131. #if __ATFILE_VISIBLE && !defined(__INSIDE_CYGWIN__)
  132. int fchmodat (int, const char *, mode_t, int);
  133. int fstatat (int, const char *__restrict , struct stat *__restrict, int);
  134. int mkdirat (int, const char *, mode_t);
  135. int mkfifoat (int, const char *, mode_t);
  136. int mknodat (int, const char *, mode_t, dev_t);
  137. int utimensat (int, const char *, const struct timespec *, int);
  138. #endif
  139. #if __POSIX_VISIBLE >= 200809 && !defined(__INSIDE_CYGWIN__)
  140. int futimens (int, const struct timespec *);
  141. #endif
  142. /* Provide prototypes for most of the _<systemcall> names that are
  143. provided in newlib for some compilers. */
  144. #ifdef _COMPILING_NEWLIB
  145. int _fstat (int __fd, struct stat *__sbuf );
  146. int _stat (const char *__restrict __path, struct stat *__restrict __sbuf );
  147. int _mkdir (const char *_path, mode_t __mode );
  148. #ifdef __LARGE64_FILES
  149. struct stat64;
  150. int _stat64 (const char *__restrict __path, struct stat64 *__restrict __sbuf );
  151. int _fstat64 (int __fd, struct stat64 *__sbuf );
  152. #endif
  153. #endif
  154. #endif /* !_STAT_H_ */
  155. #ifdef __cplusplus
  156. }
  157. #endif
  158. #endif /* _SYS_STAT_H */