STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
stat.h
Go to the documentation of this file.
1 /***
2 *sys/stat.h - defines structure used by stat() and fstat()
3 *
4 * Copyright (c) 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 
15 #pragma once
16 
17 #ifndef _INC_STAT
18 #define _INC_STAT
19 
20 #if !defined (_WIN32)
21 #error ERROR: Only Win32 target supported!
22 #endif /* !defined (_WIN32) */
23 
24 #include <crtdefs.h>
25 
26 
27 #pragma pack(push,_CRT_PACKING)
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32 
33 
34 #ifdef _CRTBLD
35 #include <cruntime.h>
36 #endif /* _CRTBLD */
37 
38 
39 /* Define _CRTIMP */
40 
41 #ifndef _CRTIMP
42 #if defined(CRTDLL) && defined(_CRTBLD)
43 #define _CRTIMP __declspec(dllexport)
44 #else /* CRTDLL && _CRTBLD */
45 #ifdef _DLL
46 #define _CRTIMP __declspec(dllimport)
47 #else /* _DLL */
48 #define _CRTIMP
49 #endif /* _DLL */
50 #endif /* CRTDLL && _CRTBLD */
51 #endif /* _CRTIMP */
52 
53 #include <sys/types.h>
54 
55 #if !defined (_W64)
56 #if !defined (__midl) && (defined (_X86_) || defined (_M_IX86))
57 #define _W64 __w64
58 #else /* !defined (__midl) && (defined (_X86_) || defined (_M_IX86)) */
59 #define _W64
60 #endif /* !defined (__midl) && (defined (_X86_) || defined (_M_IX86)) */
61 #endif /* !defined (_W64) */
62 
63 #ifndef _TIME32_T_DEFINED
64 typedef _W64 long __time32_t; /* 32-bit time value */
65 #define _TIME32_T_DEFINED
66 #endif /* _TIME32_T_DEFINED */
67 
68 #ifndef _TIME64_T_DEFINED
69 typedef __int64 __time64_t; /* 64-bit time value */
70 #define _TIME64_T_DEFINED
71 #endif /* _TIME64_T_DEFINED */
72 
73 #ifndef _TIME_T_DEFINED
74 #ifdef _USE_32BIT_TIME_T
75 typedef __time32_t time_t; /* time value */
76 #else /* _USE_32BIT_TIME_T */
77 typedef __time64_t time_t; /* time value */
78 #endif /* _USE_32BIT_TIME_T */
79 #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
80 #endif /* _TIME_T_DEFINED */
81 
82 #ifndef _WCHAR_T_DEFINED
83 typedef unsigned short wchar_t;
84 #define _WCHAR_T_DEFINED
85 #endif /* _WCHAR_T_DEFINED */
86 
87 
88 /* define structure for returning status information */
89 
90 #ifndef _STAT_DEFINED
91 
92 struct _stat32 {
95  unsigned short st_mode;
96  short st_nlink;
97  short st_uid;
98  short st_gid;
101  __time32_t st_atime;
102  __time32_t st_mtime;
103  __time32_t st_ctime;
104  };
105 
106 #if !__STDC__
107 /* Non-ANSI names for compatibility */
108 struct stat {
111  unsigned short st_mode;
112  short st_nlink;
113  short st_uid;
114  short st_gid;
117  time_t st_atime;
118  time_t st_mtime;
119  time_t st_ctime;
120  };
121 
122 #endif /* !__STDC__ */
123 
124 struct _stat32i64 {
127  unsigned short st_mode;
128  short st_nlink;
129  short st_uid;
130  short st_gid;
132  __int64 st_size;
133  __time32_t st_atime;
134  __time32_t st_mtime;
135  __time32_t st_ctime;
136  };
137 
138 struct _stat64i32 {
141  unsigned short st_mode;
142  short st_nlink;
143  short st_uid;
144  short st_gid;
147  __time64_t st_atime;
148  __time64_t st_mtime;
149  __time64_t st_ctime;
150  };
151 
152 struct _stat64 {
155  unsigned short st_mode;
156  short st_nlink;
157  short st_uid;
158  short st_gid;
160  __int64 st_size;
161  __time64_t st_atime;
162  __time64_t st_mtime;
163  __time64_t st_ctime;
164  };
165 
166 /*
167  * We have to have same name for structure and the fuction so as to do the
168  * macro magic.we need the structure name and function name the same.
169  */
170 #define __stat64 _stat64
171 
172 #ifdef _USE_32BIT_TIME_T
173 #define _fstat _fstat32
174 #define _fstati64 _fstat32i64
175 #define _stat _stat32
176 #define _stati64 _stat32i64
177 #define _wstat _wstat32
178 #define _wstati64 _wstat32i64
179 
180 #else /* _USE_32BIT_TIME_T */
181 #define _fstat _fstat64i32
182 #define _fstati64 _fstat64
183 #define _stat _stat64i32
184 #define _stati64 _stat64
185 #define _wstat _wstat64i32
186 #define _wstati64 _wstat64
187 
188 #endif /* _USE_32BIT_TIME_T */
189 
190 #define _STAT_DEFINED
191 #endif /* _STAT_DEFINED */
192 
193 
194 #define _S_IFMT 0xF000 /* file type mask */
195 #define _S_IFDIR 0x4000 /* directory */
196 #define _S_IFCHR 0x2000 /* character special */
197 #define _S_IFIFO 0x1000 /* pipe */
198 #define _S_IFREG 0x8000 /* regular */
199 #define _S_IREAD 0x0100 /* read permission, owner */
200 #define _S_IWRITE 0x0080 /* write permission, owner */
201 #define _S_IEXEC 0x0040 /* execute/search permission, owner */
202 
203 
204 /* Function prototypes */
205 
206 _CRTIMP int __cdecl _fstat32(_In_ int _FileDes, _Out_ struct _stat32 * _Stat);
207 _CRTIMP int __cdecl _stat32(_In_z_ const char * _Name, _Out_ struct _stat32 * _Stat);
208 
209 _CRTIMP int __cdecl _fstat32i64(_In_ int _FileDes, _Out_ struct _stat32i64 * _Stat);
210 _CRTIMP int __cdecl _fstat64i32(_In_ int _FileDes, _Out_ struct _stat64i32 * _Stat);
211 _CRTIMP int __cdecl _fstat64(_In_ int _FileDes, _Out_ struct _stat64 * _Stat);
212 _CRTIMP int __cdecl _stat32i64(_In_z_ const char * _Name, _Out_ struct _stat32i64 * _Stat);
213 _CRTIMP int __cdecl _stat64i32(_In_z_ const char * _Name, _Out_ struct _stat64i32 * _Stat);
214 _CRTIMP int __cdecl _stat64(_In_z_ const char * _Name, _Out_ struct _stat64 * _Stat);
215 
216 #ifndef _WSTAT_DEFINED
217 
218 /* also declared in wchar.h */
219 
220 _CRTIMP int __cdecl _wstat32(_In_z_ const wchar_t * _Name, _Out_ struct _stat32 * _Stat);
221 
222 _CRTIMP int __cdecl _wstat32i64(_In_z_ const wchar_t * _Name, _Out_ struct _stat32i64 * _Stat);
223 _CRTIMP int __cdecl _wstat64i32(_In_z_ const wchar_t * _Name, _Out_ struct _stat64i32 * _Stat);
224 _CRTIMP int __cdecl _wstat64(_In_z_ const wchar_t * _Name, _Out_ struct _stat64 * _Stat);
225 
226 #define _WSTAT_DEFINED
227 #endif /* _WSTAT_DEFINED */
228 
229 #if !__STDC__
230 
231 /* Non-ANSI names for compatibility */
232 
233 #define S_IFMT _S_IFMT
234 #define S_IFDIR _S_IFDIR
235 #define S_IFCHR _S_IFCHR
236 #define S_IFREG _S_IFREG
237 #define S_IREAD _S_IREAD
238 #define S_IWRITE _S_IWRITE
239 #define S_IEXEC _S_IEXEC
240 
241 #endif /* !__STDC__ */
242 
243 /*
244  * This file is included for __inlined non stdc functions. i.e. stat and fstat
245  */
246 #if !defined (RC_INVOKED) && !defined (__midl)
247 #include <sys/stat.inl>
248 #endif /* !defined (RC_INVOKED) && !defined (__midl) */
249 
250 #ifdef __cplusplus
251 }
252 #endif /* __cplusplus */
253 
254 #pragma pack(pop)
255 
256 #endif /* _INC_STAT */
#define _Out_
Definition: sal.h:351
short st_nlink
Definition: stat.h:112
_dev_t st_rdev
Definition: stat.h:99
_ino_t st_ino
Definition: stat.h:126
_dev_t st_dev
Definition: stat.h:153
__int64 st_size
Definition: stat.h:160
__time64_t time_t
Definition: stat.h:77
time_t st_ctime
Definition: stat.h:119
_CRTIMP int __cdecl _stat64i32(_In_z_ const char *_Name, _Out_ struct _stat64i32 *_Stat)
__time32_t st_ctime
Definition: stat.h:135
_CRTIMP int __cdecl _fstat64(_In_ int _FileDes, _Out_ struct _stat64 *_Stat)
__time32_t st_atime
Definition: stat.h:101
_CRTIMP int __cdecl _stat32(_In_z_ const char *_Name, _Out_ struct _stat32 *_Stat)
_dev_t st_dev
Definition: stat.h:125
_CRTIMP int __cdecl _fstat64i32(_In_ int _FileDes, _Out_ struct _stat64i32 *_Stat)
_dev_t st_rdev
Definition: stat.h:145
short st_uid
Definition: stat.h:143
unsigned short st_mode
Definition: stat.h:155
unsigned short st_mode
Definition: stat.h:127
__time64_t st_atime
Definition: stat.h:161
__time32_t st_ctime
Definition: stat.h:103
#define _CRTIMP
Definition: stat.h:48
unsigned short wchar_t
Definition: stat.h:83
__time32_t st_mtime
Definition: stat.h:134
short st_gid
Definition: stat.h:98
_ino_t st_ino
Definition: stat.h:110
_dev_t st_rdev
Definition: stat.h:131
short st_uid
Definition: stat.h:113
_dev_t st_rdev
Definition: stat.h:159
short st_gid
Definition: stat.h:130
short st_uid
Definition: stat.h:129
_CRTIMP int __cdecl _fstat32(_In_ int _FileDes, _Out_ struct _stat32 *_Stat)
short st_gid
Definition: stat.h:114
__time64_t st_atime
Definition: stat.h:147
_dev_t st_dev
Definition: stat.h:109
#define _In_z_
Definition: sal.h:319
#define _In_
Definition: sal.h:314
unsigned short _ino_t
Definition: types.h:61
short st_nlink
Definition: stat.h:142
_off_t st_size
Definition: stat.h:100
Definition: stat.h:152
__time64_t st_ctime
Definition: stat.h:163
short st_gid
Definition: stat.h:158
_dev_t st_dev
Definition: stat.h:139
__int64 st_size
Definition: stat.h:132
short st_nlink
Definition: stat.h:96
_CRTIMP int __cdecl _stat64(_In_z_ const char *_Name, _Out_ struct _stat64 *_Stat)
__time64_t st_mtime
Definition: stat.h:162
_FS_DLL file_type __CLRCALL_PURE_OR_CDECL _Stat(const char *, int &)
unsigned short st_mode
Definition: stat.h:95
short st_uid
Definition: stat.h:97
unsigned short st_mode
Definition: stat.h:111
Definition: stat.h:108
_CRTIMP int __cdecl _wstat64i32(_In_z_ const wchar_t *_Name, _Out_ struct _stat64i32 *_Stat)
_dev_t st_rdev
Definition: stat.h:115
unsigned int _dev_t
Definition: types.h:74
__time32_t st_mtime
Definition: stat.h:102
_W64 long __time32_t
Definition: stat.h:64
__time64_t st_mtime
Definition: stat.h:148
_ino_t st_ino
Definition: stat.h:154
_CRTIMP int __cdecl _wstat64(_In_z_ const wchar_t *_Name, _Out_ struct _stat64 *_Stat)
__time64_t st_ctime
Definition: stat.h:149
_ino_t st_ino
Definition: stat.h:94
Definition: stat.h:138
short st_gid
Definition: stat.h:144
_CRTIMP int __cdecl _fstat32i64(_In_ int _FileDes, _Out_ struct _stat32i64 *_Stat)
time_t st_atime
Definition: stat.h:117
short st_uid
Definition: stat.h:157
unsigned short st_mode
Definition: stat.h:141
_CRTIMP int __cdecl _wstat32i64(_In_z_ const wchar_t *_Name, _Out_ struct _stat32i64 *_Stat)
short st_nlink
Definition: stat.h:156
short st_nlink
Definition: stat.h:128
_ino_t st_ino
Definition: stat.h:140
Definition: stat.h:124
Definition: stat.h:92
_CRTIMP int __cdecl _stat32i64(_In_z_ const char *_Name, _Out_ struct _stat32i64 *_Stat)
_dev_t st_dev
Definition: stat.h:93
#define _W64
Definition: stat.h:59
time_t st_mtime
Definition: stat.h:118
__int64 __time64_t
Definition: stat.h:69
__time32_t st_atime
Definition: stat.h:133
_off_t st_size
Definition: stat.h:146
_CRTIMP int __cdecl _wstat32(_In_z_ const wchar_t *_Name, _Out_ struct _stat32 *_Stat)
long _off_t
Definition: types.h:87
_off_t st_size
Definition: stat.h:116