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.

202 lines
4.1 KiB

  1. /***
  2. *sys/stat.h - defines structure used by stat() and fstat()
  3. *
  4. * Copyright (c) 1985-1997, 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) && !defined(_MAC)
  20. #error ERROR: Only Mac or Win32 targets 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. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  41. #ifndef _CRTAPI1
  42. #if _MSC_VER >= 800 && _M_IX86 >= 300
  43. #define _CRTAPI1 __cdecl
  44. #else
  45. #define _CRTAPI1
  46. #endif
  47. #endif
  48. #include <sys/types.h>
  49. #ifndef _TIME_T_DEFINED
  50. typedef long time_t;
  51. #define _TIME_T_DEFINED
  52. #endif
  53. #ifdef _WIN32
  54. #ifndef _WCHAR_T_DEFINED
  55. typedef unsigned short wchar_t;
  56. #define _WCHAR_T_DEFINED
  57. #endif
  58. #endif /* _WIN32 */
  59. /* define structure for returning status information */
  60. #ifndef _STAT_DEFINED
  61. struct _stat {
  62. _dev_t st_dev;
  63. _ino_t st_ino;
  64. unsigned short st_mode;
  65. short st_nlink;
  66. short st_uid;
  67. short st_gid;
  68. _dev_t st_rdev;
  69. _off_t st_size;
  70. time_t st_atime;
  71. time_t st_mtime;
  72. time_t st_ctime;
  73. };
  74. #if !__STDC__
  75. /* Non-ANSI names for compatibility */
  76. struct stat {
  77. _dev_t st_dev;
  78. _ino_t st_ino;
  79. unsigned short st_mode;
  80. short st_nlink;
  81. short st_uid;
  82. short st_gid;
  83. _dev_t st_rdev;
  84. _off_t st_size;
  85. time_t st_atime;
  86. time_t st_mtime;
  87. time_t st_ctime;
  88. };
  89. #endif /* __STDC__ */
  90. #if _INTEGRAL_MAX_BITS >= 64
  91. struct _stati64 {
  92. _dev_t st_dev;
  93. _ino_t st_ino;
  94. unsigned short st_mode;
  95. short st_nlink;
  96. short st_uid;
  97. short st_gid;
  98. _dev_t st_rdev;
  99. __int64 st_size;
  100. time_t st_atime;
  101. time_t st_mtime;
  102. time_t st_ctime;
  103. };
  104. #endif
  105. #define _STAT_DEFINED
  106. #endif
  107. #define _S_IFMT 0170000 /* file type mask */
  108. #define _S_IFDIR 0040000 /* directory */
  109. #define _S_IFCHR 0020000 /* character special */
  110. #define _S_IFIFO 0010000 /* pipe */
  111. #define _S_IFREG 0100000 /* regular */
  112. #define _S_IREAD 0000400 /* read permission, owner */
  113. #define _S_IWRITE 0000200 /* write permission, owner */
  114. #define _S_IEXEC 0000100 /* execute/search permission, owner */
  115. /* Function prototypes */
  116. _CRTIMP int __cdecl _fstat(int, struct _stat *);
  117. _CRTIMP int __cdecl _stat(const char *, struct _stat *);
  118. #if _INTEGRAL_MAX_BITS >= 64
  119. _CRTIMP int __cdecl _fstati64(int, struct _stati64 *);
  120. _CRTIMP int __cdecl _stati64(const char *, struct _stati64 *);
  121. #endif
  122. #ifdef _WIN32
  123. #ifndef _WSTAT_DEFINED
  124. /* wide function prototypes, also declared in wchar.h */
  125. _CRTIMP int __cdecl _wstat(const wchar_t *, struct _stat *);
  126. #if _INTEGRAL_MAX_BITS >= 64
  127. _CRTIMP int __cdecl _wstati64(const wchar_t *, struct _stati64 *);
  128. #endif
  129. #define _WSTAT_DEFINED
  130. #endif
  131. #endif /* _WIN32 */
  132. #if !__STDC__
  133. /* Non-ANSI names for compatibility */
  134. #define S_IFMT _S_IFMT
  135. #define S_IFDIR _S_IFDIR
  136. #define S_IFCHR _S_IFCHR
  137. #define S_IFREG _S_IFREG
  138. #define S_IREAD _S_IREAD
  139. #define S_IWRITE _S_IWRITE
  140. #define S_IEXEC _S_IEXEC
  141. _CRTIMP int __cdecl fstat(int, struct stat *);
  142. _CRTIMP int __cdecl stat(const char *, struct stat *);
  143. #endif /* __STDC__ */
  144. #ifdef __cplusplus
  145. }
  146. #endif
  147. #ifdef _MSC_VER
  148. #pragma pack(pop)
  149. #endif /* _MSC_VER */
  150. #endif /* _INC_STAT */