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.

274 lines
7.8 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. *Revision History:
  14. * 07-28-87 SKS Fixed TIME_T_DEFINED to be _TIME_T_DEFINED
  15. * 12-11-87 JCR Added "_loadds" functionality
  16. * 12-18-87 JCR Added _FAR_ to declarations
  17. * 02-10-88 JCR Cleaned up white space
  18. * 08-22-88 GJF Modified to also work for the 386 (small model only)
  19. * 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
  20. * 08-22-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
  21. * 10-30-89 GJF Fixed copyright
  22. * 11-02-89 JCR Changed "DLL" to "_DLL"
  23. * 03-09-90 GJF Added #ifndef _INC_STAT and #include <cruntime.h>
  24. * stuff. Also, removed some (now) useless preprocessor
  25. * directives.
  26. * 03-21-90 GJF Replaced _cdecl with _CALLTYPE1.
  27. * 01-18-91 GJF ANSI naming.
  28. * 01-25-91 GJF Protect _stat struct with pack pragma.
  29. * 08-20-91 JCR C++ and ANSI naming
  30. * 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
  31. * 08-07-92 GJF Function calling type and variable type macros. Also
  32. * #include <types.h> (common user request).
  33. * 11-10-92 SKS Need #pragma pack(4) around definition of struct _stat
  34. * in case the user has specified non-default packing
  35. * 12-15-92 GJF Added _S_IFIFO for pipes (based on Unix/Posix def.
  36. * for FIFO special files and pipes).
  37. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  38. * 04-06-93 SKS Replace _CRTAPI1/2 with __cdecl, _CRTVAR1 with nothing
  39. * 04-07-93 GJF Changed type of first arg to _stat to const char *.
  40. * 04-07-93 SKS Add _CRTIMP keyword for CRT DLL model
  41. * Use link-time aliases for old names, not #define's
  42. * 10-13-93 GJF Merged NT and Cuda versions.
  43. * 12-16-93 GJF Add _wstat.
  44. * 11-03-94 GJF Changed pack pragma to 8 byte alignment.
  45. * 12-28-94 GJF Added _stati64 structure and protos for _fstati64,
  46. * _[w]stati64.
  47. * 02-14-95 CFW Clean up Mac merge, add _CRTBLD.
  48. * 04-27-95 CFW Add mac/win32 test.
  49. * 12-14-95 JWM Add "#pragma once".
  50. * 01-23-97 GJF Cleaned out obsolete support for _NTSDK and _CRTAPI*.
  51. * Also, detab-ed.
  52. * 09-30-97 JWM Restored not-so-obsolete _CRTAPI1 support.
  53. * 10-07-97 RDL Added IA64.
  54. * 05-06-98 GJF Added __time64_t support.
  55. * 02-25-99 GJF Changed time_t to __int64
  56. * 05-13-99 PML Remove _CRTAPI1
  57. * 05-17-99 PML Remove all Macintosh support.
  58. *
  59. ****/
  60. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  61. #pragma once
  62. #endif
  63. #ifndef _INC_STAT
  64. #define _INC_STAT
  65. #if !defined(_WIN32)
  66. #error ERROR: Only Win32 target supported!
  67. #endif
  68. #ifndef _CRTBLD
  69. /* This version of the header files is NOT for user programs.
  70. * It is intended for use when building the C runtimes ONLY.
  71. * The version intended for public use will not have this message.
  72. */
  73. #error ERROR: Use of C runtime library internal header file.
  74. #endif /* _CRTBLD */
  75. #ifdef _MSC_VER
  76. #pragma pack(push,8)
  77. #endif /* _MSC_VER */
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81. #ifndef _INTERNAL_IFSTRIP_
  82. #include <cruntime.h>
  83. #endif /* _INTERNAL_IFSTRIP_ */
  84. /* Define _CRTIMP */
  85. #ifndef _CRTIMP
  86. #ifdef CRTDLL
  87. #define _CRTIMP __declspec(dllexport)
  88. #else /* ndef CRTDLL */
  89. #ifdef _DLL
  90. #define _CRTIMP __declspec(dllimport)
  91. #else /* ndef _DLL */
  92. #define _CRTIMP
  93. #endif /* _DLL */
  94. #endif /* CRTDLL */
  95. #endif /* _CRTIMP */
  96. /* Define __cdecl for non-Microsoft compilers */
  97. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  98. #define __cdecl
  99. #endif
  100. #include <sys/types.h>
  101. #ifndef _TIME_T_DEFINED
  102. #ifdef _WIN64
  103. typedef __int64 time_t; /* time value */
  104. #else
  105. typedef long time_t; /* time value */
  106. #endif
  107. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  108. typedef __int64 __time64_t; /* 64-bit time value */
  109. #endif
  110. #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
  111. #endif
  112. #ifndef _WCHAR_T_DEFINED
  113. typedef unsigned short wchar_t;
  114. #define _WCHAR_T_DEFINED
  115. #endif
  116. /* define structure for returning status information */
  117. #ifndef _STAT_DEFINED
  118. struct _stat {
  119. _dev_t st_dev;
  120. _ino_t st_ino;
  121. unsigned short st_mode;
  122. short st_nlink;
  123. short st_uid;
  124. short st_gid;
  125. _dev_t st_rdev;
  126. _off_t st_size;
  127. time_t st_atime;
  128. time_t st_mtime;
  129. time_t st_ctime;
  130. };
  131. #if !__STDC__
  132. /* Non-ANSI names for compatibility */
  133. struct stat {
  134. _dev_t st_dev;
  135. _ino_t st_ino;
  136. unsigned short st_mode;
  137. short st_nlink;
  138. short st_uid;
  139. short st_gid;
  140. _dev_t st_rdev;
  141. _off_t st_size;
  142. time_t st_atime;
  143. time_t st_mtime;
  144. time_t st_ctime;
  145. };
  146. #endif /* __STDC__ */
  147. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  148. struct _stati64 {
  149. _dev_t st_dev;
  150. _ino_t st_ino;
  151. unsigned short st_mode;
  152. short st_nlink;
  153. short st_uid;
  154. short st_gid;
  155. _dev_t st_rdev;
  156. __int64 st_size;
  157. time_t st_atime;
  158. time_t st_mtime;
  159. time_t st_ctime;
  160. };
  161. struct __stat64 {
  162. _dev_t st_dev;
  163. _ino_t st_ino;
  164. unsigned short st_mode;
  165. short st_nlink;
  166. short st_uid;
  167. short st_gid;
  168. _dev_t st_rdev;
  169. __int64 st_size;
  170. __time64_t st_atime;
  171. __time64_t st_mtime;
  172. __time64_t st_ctime;
  173. };
  174. #endif
  175. #define _STAT_DEFINED
  176. #endif
  177. #define _S_IFMT 0170000 /* file type mask */
  178. #define _S_IFDIR 0040000 /* directory */
  179. #define _S_IFCHR 0020000 /* character special */
  180. #define _S_IFIFO 0010000 /* pipe */
  181. #define _S_IFREG 0100000 /* regular */
  182. #define _S_IREAD 0000400 /* read permission, owner */
  183. #define _S_IWRITE 0000200 /* write permission, owner */
  184. #define _S_IEXEC 0000100 /* execute/search permission, owner */
  185. /* Function prototypes */
  186. _CRTIMP int __cdecl _fstat(int, struct _stat *);
  187. _CRTIMP int __cdecl _stat(const char *, struct _stat *);
  188. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  189. _CRTIMP int __cdecl _fstati64(int, struct _stati64 *);
  190. _CRTIMP int __cdecl _fstat64(int, struct __stat64 *);
  191. _CRTIMP int __cdecl _stati64(const char *, struct _stati64 *);
  192. _CRTIMP int __cdecl _stat64(const char *, struct __stat64 *);
  193. #endif
  194. #ifndef _WSTAT_DEFINED
  195. /* wide function prototypes, also declared in wchar.h */
  196. _CRTIMP int __cdecl _wstat(const wchar_t *, struct _stat *);
  197. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  198. _CRTIMP int __cdecl _wstati64(const wchar_t *, struct _stati64 *);
  199. _CRTIMP int __cdecl _wstat64(const wchar_t *, struct __stat64 *);
  200. #endif
  201. #define _WSTAT_DEFINED
  202. #endif
  203. #if !__STDC__
  204. /* Non-ANSI names for compatibility */
  205. #define S_IFMT _S_IFMT
  206. #define S_IFDIR _S_IFDIR
  207. #define S_IFCHR _S_IFCHR
  208. #define S_IFREG _S_IFREG
  209. #define S_IREAD _S_IREAD
  210. #define S_IWRITE _S_IWRITE
  211. #define S_IEXEC _S_IEXEC
  212. _CRTIMP int __cdecl fstat(int, struct stat *);
  213. _CRTIMP int __cdecl stat(const char *, struct stat *);
  214. #endif /* __STDC__ */
  215. #ifdef __cplusplus
  216. }
  217. #endif
  218. #ifdef _MSC_VER
  219. #pragma pack(pop)
  220. #endif /* _MSC_VER */
  221. #endif /* _INC_STAT */