Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
4.6 KiB

  1. /***
  2. *sys/stat.h - defines structure used by stat() and fstat()
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file defines the structure used by the _stat() and _fstat()
  8. * routines.
  9. * [System V]
  10. *
  11. * [Public]
  12. *
  13. ****/
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifndef _INC_STAT
  18. #define _INC_STAT
  19. #if !defined(_WIN32)
  20. #error ERROR: Only Win32 target supported!
  21. #endif
  22. #ifdef _MSC_VER
  23. #pragma pack(push,8)
  24. #endif /* _MSC_VER */
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Define _CRTIMP */
  29. #ifndef _CRTIMP
  30. #ifdef _DLL
  31. #define _CRTIMP __declspec(dllimport)
  32. #else /* ndef _DLL */
  33. #define _CRTIMP
  34. #endif /* _DLL */
  35. #endif /* _CRTIMP */
  36. /* Define __cdecl for non-Microsoft compilers */
  37. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  38. #define __cdecl
  39. #endif
  40. #include <sys/types.h>
  41. #ifndef _TIME_T_DEFINED
  42. #ifdef _WIN64
  43. typedef __int64 time_t; /* time value */
  44. #else
  45. typedef long time_t; /* time value */
  46. #endif
  47. #if _INTEGRAL_MAX_BITS >= 64
  48. typedef __int64 __time64_t; /* 64-bit time value */
  49. #endif
  50. #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
  51. #endif
  52. #if !defined(_WCHAR_T_DEFINED) && !defined(_NATIVE_WCHAR_T_DEFINED)
  53. typedef unsigned short wchar_t;
  54. #define _WCHAR_T_DEFINED
  55. #endif
  56. /* define structure for returning status information */
  57. #ifndef _STAT_DEFINED
  58. struct _stat {
  59. _dev_t st_dev;
  60. _ino_t st_ino;
  61. unsigned short st_mode;
  62. short st_nlink;
  63. short st_uid;
  64. short st_gid;
  65. _dev_t st_rdev;
  66. _off_t st_size;
  67. time_t st_atime;
  68. time_t st_mtime;
  69. time_t st_ctime;
  70. };
  71. #if !__STDC__
  72. /* Non-ANSI names for compatibility */
  73. struct stat {
  74. _dev_t st_dev;
  75. _ino_t st_ino;
  76. unsigned short st_mode;
  77. short st_nlink;
  78. short st_uid;
  79. short st_gid;
  80. _dev_t st_rdev;
  81. _off_t st_size;
  82. time_t st_atime;
  83. time_t st_mtime;
  84. time_t st_ctime;
  85. };
  86. #endif /* __STDC__ */
  87. #if _INTEGRAL_MAX_BITS >= 64
  88. struct _stati64 {
  89. _dev_t st_dev;
  90. _ino_t st_ino;
  91. unsigned short st_mode;
  92. short st_nlink;
  93. short st_uid;
  94. short st_gid;
  95. _dev_t st_rdev;
  96. __int64 st_size;
  97. time_t st_atime;
  98. time_t st_mtime;
  99. time_t st_ctime;
  100. };
  101. struct __stat64 {
  102. _dev_t st_dev;
  103. _ino_t st_ino;
  104. unsigned short st_mode;
  105. short st_nlink;
  106. short st_uid;
  107. short st_gid;
  108. _dev_t st_rdev;
  109. __int64 st_size;
  110. __time64_t st_atime;
  111. __time64_t st_mtime;
  112. __time64_t st_ctime;
  113. };
  114. #endif
  115. #define _STAT_DEFINED
  116. #endif
  117. #define _S_IFMT 0170000 /* file type mask */
  118. #define _S_IFDIR 0040000 /* directory */
  119. #define _S_IFCHR 0020000 /* character special */
  120. #define _S_IFIFO 0010000 /* pipe */
  121. #define _S_IFREG 0100000 /* regular */
  122. #define _S_IREAD 0000400 /* read permission, owner */
  123. #define _S_IWRITE 0000200 /* write permission, owner */
  124. #define _S_IEXEC 0000100 /* execute/search permission, owner */
  125. /* Function prototypes */
  126. _CRTIMP int __cdecl _fstat(int, struct _stat *);
  127. _CRTIMP int __cdecl _stat(const char *, struct _stat *);
  128. #if _INTEGRAL_MAX_BITS >= 64
  129. _CRTIMP int __cdecl _fstati64(int, struct _stati64 *);
  130. _CRTIMP int __cdecl _fstat64(int, struct __stat64 *);
  131. _CRTIMP int __cdecl _stati64(const char *, struct _stati64 *);
  132. _CRTIMP int __cdecl _stat64(const char *, struct __stat64 *);
  133. #endif
  134. #ifndef _WSTAT_DEFINED
  135. /* wide function prototypes, also declared in wchar.h */
  136. _CRTIMP int __cdecl _wstat(const wchar_t *, struct _stat *);
  137. #if _INTEGRAL_MAX_BITS >= 64
  138. _CRTIMP int __cdecl _wstati64(const wchar_t *, struct _stati64 *);
  139. _CRTIMP int __cdecl _wstat64(const wchar_t *, struct __stat64 *);
  140. #endif
  141. #define _WSTAT_DEFINED
  142. #endif
  143. #if !__STDC__
  144. /* Non-ANSI names for compatibility */
  145. #define S_IFMT _S_IFMT
  146. #define S_IFDIR _S_IFDIR
  147. #define S_IFCHR _S_IFCHR
  148. #define S_IFREG _S_IFREG
  149. #define S_IREAD _S_IREAD
  150. #define S_IWRITE _S_IWRITE
  151. #define S_IEXEC _S_IEXEC
  152. _CRTIMP int __cdecl fstat(int, struct stat *);
  153. _CRTIMP int __cdecl stat(const char *, struct stat *);
  154. #endif /* __STDC__ */
  155. #ifdef __cplusplus
  156. }
  157. #endif
  158. #ifdef _MSC_VER
  159. #pragma pack(pop)
  160. #endif /* _MSC_VER */
  161. #endif /* _INC_STAT */