/hardware/tools/lm4f/arm-none-eabi/include/sys/stat.h

https://gitlab.com/murixteam/energia-0101e0012-windows-mwc · C Header · 183 lines · 152 code · 21 blank · 10 comment · 13 complexity · d16d7394e0635bbde4fdf99604d80e0d MD5 · raw file

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