stat.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. #ifndef _SYS_STAT_H
  2. #define _SYS_STAT_H
  3. #include <features.h>
  4. #include <sys/types.h>
  5. #undef __NOT_KERNEL
  6. #define __NOT_KERNEL
  7. #include <linux/stat.h>
  8. #undef __NOT_KERNEL
  9. #ifdef __SVR4_I386_ABI_L1__
  10. #include <sys/time.h> /* For timestruc_t */
  11. #endif /* __SVR4_I386_ABI_L1__ */
  12. __BEGIN_DECLS
  13. struct stat {
  14. dev_t st_dev;
  15. #ifdef __SVR4_I386_ABI_L1__
  16. long st_pad1[3];
  17. #else
  18. unsigned short __pad1;
  19. #endif
  20. ino_t st_ino;
  21. umode_t st_mode;
  22. nlink_t st_nlink;
  23. uid_t st_uid;
  24. gid_t st_gid;
  25. dev_t st_rdev;
  26. #ifdef __SVR4_I386_ABI_L1__
  27. long st_pad2[2];
  28. #else
  29. unsigned short __pad2;
  30. #endif
  31. off_t st_size;
  32. #ifdef __SVR4_I386_ABI_L1__
  33. timestruc_t st_atim;
  34. timestruc_t st_mtim;
  35. timestruc_t st_ctim;
  36. long st_blksize;
  37. long st_blocks;
  38. #define FSTYPSZ 16
  39. char st_fstype[FSTYPSZ];
  40. long st_pad4[8];
  41. #define st_atime st_atim.tv_sec
  42. #define st_mtime st_mtim.tv_sec
  43. #define st_ctime st_ctim.tv_sec
  44. #else /*! __SVR4_I386_ABI_L1__*/
  45. unsigned long st_blksize;
  46. unsigned long st_blocks;
  47. time_t st_atime;
  48. unsigned long __unused1;
  49. time_t st_mtime;
  50. unsigned long __unused2;
  51. time_t st_ctime;
  52. unsigned long __unused3;
  53. unsigned long __unused4;
  54. unsigned long __unused5;
  55. #endif /*! __SVR4_I386_ABI_L1__*/
  56. };
  57. #define LINUX_MKNOD_VERSION 1 /* SVr4 */
  58. #define LINUX_STAT_VERSION 1 /* SVr4 */
  59. extern int _fxstat __P ((int __ver, int __fildes,
  60. struct stat *__stat_buf));
  61. extern int _xstat __P ((int __ver, __const char *__filename,
  62. struct stat *__stat_buf));
  63. extern int _lxstat __P ((int __ver, __const char *__filename,
  64. struct stat *__stat_buf));
  65. #ifdef _MIT_POSIX_THREADS
  66. extern int __machdep_sys__fxstat __P ((int __ver, int __fd,
  67. struct stat *__stat_buf));
  68. #endif
  69. extern int _xmknod __P ((int __ver, __const char *__path,
  70. mode_t __mode, dev_t *__dev));
  71. /* Some synonyms used historically in the kernel and elsewhere */
  72. #define S_IREAD S_IRUSR /* read permission, owner */
  73. #define S_IWRITE S_IWUSR /* write permission, owner */
  74. #define S_IEXEC S_IXUSR /* execute/search permission, owner */
  75. extern int __chmod __P ((__const char *__path, mode_t __mode));
  76. extern int chmod __P ((__const char *__path, mode_t __mode));
  77. extern int __fchmod __P ((int __fildes, mode_t __mode));
  78. extern int fchmod __P ((int __fildes, mode_t __mode));
  79. extern int __mkdir __P ((__const char *__path, mode_t __mode));
  80. extern int mkdir __P ((__const char *__path, mode_t __mode));
  81. extern int mkfifo __P ((__const char *__path, mode_t __mode));
  82. #if 1
  83. extern int __fstat __P ((int __fildes, struct stat *__stat_buf));
  84. extern int fstat __P ((int __fildes, struct stat *__stat_buf));
  85. extern int __stat __P ((__const char *__filename,
  86. struct stat *__stat_buf));
  87. extern int stat __P ((__const char *__filename,
  88. struct stat *__stat_buf));
  89. extern int __lstat __P ((__const char *__filename,
  90. struct stat *__stat_buf));
  91. extern int lstat __P ((__const char *__filename,
  92. struct stat *__stat_buf));
  93. extern int __mknod __P ((__const char *__path, mode_t __mode,
  94. dev_t __dev));
  95. extern int mknod __P ((__const char *__path, mode_t __mode,
  96. dev_t __dev));
  97. #endif /* #if 0 */
  98. extern mode_t __umask __P ((mode_t __mask));
  99. extern mode_t umask __P ((mode_t __mask));
  100. __END_DECLS
  101. #if 0
  102. static __inline__ int __stat(__const char * __path, struct stat * __statbuf)
  103. {
  104. return _xstat(LINUX_STAT_VERSION, __path, __statbuf);
  105. }
  106. static __inline__ int stat(__const char * __path, struct stat * __statbuf)
  107. {
  108. return _xstat(LINUX_STAT_VERSION, __path, __statbuf);
  109. }
  110. static __inline__ int __lstat(__const char * __path, struct stat * __statbuf)
  111. {
  112. return _lxstat(LINUX_STAT_VERSION, __path, __statbuf);
  113. }
  114. static __inline__ int lstat(__const char * __path, struct stat * __statbuf)
  115. {
  116. return _lxstat(LINUX_STAT_VERSION, __path, __statbuf);
  117. }
  118. static __inline__ int __fstat(int __fd, struct stat * __statbuf)
  119. {
  120. return _fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
  121. }
  122. static __inline__ int fstat(int __fd, struct stat * __statbuf)
  123. {
  124. return _fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
  125. }
  126. static __inline__ int __mknod(__const char * __path, mode_t __mode, dev_t __dev)
  127. {
  128. return _xmknod(LINUX_MKNOD_VERSION, __path, __mode, &__dev);
  129. }
  130. static __inline__ int mknod(__const char * __path, mode_t __mode, dev_t __dev)
  131. {
  132. return _xmknod(LINUX_MKNOD_VERSION, __path, __mode, &__dev);
  133. }
  134. #ifdef _MIT_POSIX_THREADS
  135. static __inline__ int __machdep_sys_fstat(int __fd, struct stat * __statbuf)
  136. {
  137. return __machdep_sys__fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
  138. }
  139. static __inline__ int machdep_sys_fstat(int __fd, struct stat * __statbuf)
  140. {
  141. return __machdep_sys__fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
  142. }
  143. #endif
  144. #endif
  145. #endif