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
3 //
4 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The _stat() and _fstat() families of functions.
7 //
8 #pragma once
9 
10 #include <corecrt.h>
11 #include <sys/types.h>
12 
14 
15 
16 #pragma warning(push)
17 #pragma warning(disable: 4820) /* padding added after data member */
18 
19 
20 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21 //
22 // Types
23 //
24 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25 struct _stat32
26 {
29  unsigned short st_mode;
30  short st_nlink;
31  short st_uid;
32  short st_gid;
38 };
39 
40 struct _stat32i64
41 {
44  unsigned short st_mode;
45  short st_nlink;
46  short st_uid;
47  short st_gid;
49  __int64 st_size;
53 };
54 
55 struct _stat64i32
56 {
59  unsigned short st_mode;
60  short st_nlink;
61  short st_uid;
62  short st_gid;
68 };
69 
70 struct _stat64
71 {
74  unsigned short st_mode;
75  short st_nlink;
76  short st_uid;
77  short st_gid;
79  __int64 st_size;
83 };
84 
85 #define __stat64 _stat64 // For legacy compatibility
86 
87 #if _CRT_INTERNAL_NONSTDC_NAMES && !defined _CRT_NO_TIME_T
88  struct stat
89  {
90  _dev_t st_dev;
91  _ino_t st_ino;
92  unsigned short st_mode;
93  short st_nlink;
94  short st_uid;
95  short st_gid;
96  _dev_t st_rdev;
97  _off_t st_size;
98  time_t st_atime;
99  time_t st_mtime;
100  time_t st_ctime;
101  };
102 #endif
103 
104 
105 
106 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
107 //
108 // Flags
109 //
110 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
111 #define _S_IFMT 0xF000 // File type mask
112 #define _S_IFDIR 0x4000 // Directory
113 #define _S_IFCHR 0x2000 // Character special
114 #define _S_IFIFO 0x1000 // Pipe
115 #define _S_IFREG 0x8000 // Regular
116 #define _S_IREAD 0x0100 // Read permission, owner
117 #define _S_IWRITE 0x0080 // Write permission, owner
118 #define _S_IEXEC 0x0040 // Execute/search permission, owner
119 
120 #if _CRT_INTERNAL_NONSTDC_NAMES
121  #define S_IFMT _S_IFMT
122  #define S_IFDIR _S_IFDIR
123  #define S_IFCHR _S_IFCHR
124  #define S_IFREG _S_IFREG
125  #define S_IREAD _S_IREAD
126  #define S_IWRITE _S_IWRITE
127  #define S_IEXEC _S_IEXEC
128 #endif
129 
130 
131 
132 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
133 //
134 // Functions
135 //
136 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
137 #ifdef _USE_32BIT_TIME_T
138  #define _fstat _fstat32
139  #define _fstati64 _fstat32i64
140  #define _stat _stat32
141  #define _stati64 _stat32i64
142  #define _wstat _wstat32
143  #define _wstati64 _wstat32i64
144 #else
145  #define _fstat _fstat64i32
146  #define _fstati64 _fstat64
147  #define _stat _stat64i32
148  #define _stati64 _stat64
149  #define _wstat _wstat64i32
150  #define _wstati64 _wstat64
151 #endif
152 
153 
154 
155 _ACRTIMP int __cdecl _fstat32(
156  _In_ int _FileHandle,
157  _Out_ struct _stat32* _Stat
158  );
159 
160 _ACRTIMP int __cdecl _fstat32i64(
161  _In_ int _FileHandle,
162  _Out_ struct _stat32i64* _Stat
163  );
164 
165 _ACRTIMP int __cdecl _fstat64i32(
166  _In_ int _FileHandle,
167  _Out_ struct _stat64i32* _Stat
168  );
169 
170 _ACRTIMP int __cdecl _fstat64(
171  _In_ int _FileHandle,
172  _Out_ struct _stat64* _Stat
173  );
174 
175 _ACRTIMP int __cdecl _stat32(
176  _In_z_ char const* _FileName,
177  _Out_ struct _stat32* _Stat
178  );
179 
180 _ACRTIMP int __cdecl _stat32i64(
181  _In_z_ char const* _FileName,
182  _Out_ struct _stat32i64* _Stat
183  );
184 
185 _ACRTIMP int __cdecl _stat64i32(
186  _In_z_ char const* _FileName,
187  _Out_ struct _stat64i32* _Stat
188  );
189 
190 _ACRTIMP int __cdecl _stat64(
191  _In_z_ char const* _FileName,
192  _Out_ struct _stat64* _Stat
193  );
194 
195 _ACRTIMP int __cdecl _wstat32(
196  _In_z_ wchar_t const* _FileName,
197  _Out_ struct _stat32* _Stat
198  );
199 
200 _ACRTIMP int __cdecl _wstat32i64(
201  _In_z_ wchar_t const* _FileName,
202  _Out_ struct _stat32i64* _Stat
203  );
204 
205 _ACRTIMP int __cdecl _wstat64i32(
206  _In_z_ wchar_t const* _FileName,
207  _Out_ struct _stat64i32* _Stat
208  );
209 
210 _ACRTIMP int __cdecl _wstat64(
211  _In_z_ wchar_t const* _FileName,
212  _Out_ struct _stat64* _Stat
213  );
214 
215 
216 
217 #if !defined RC_INVOKED && !defined __midl && _CRT_INTERNAL_NONSTDC_NAMES && !defined _CRT_NO_TIME_T
218  #ifdef _USE_32BIT_TIME_T
219 
220  static __inline int __CRTDECL fstat(int const _FileHandle, struct stat* const _Stat)
221  {
222  _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat32));
223  return _fstat32(_FileHandle, (struct _stat32*)_Stat);
224  }
225 
226  static __inline int __CRTDECL stat(char const* const _FileName, struct stat* const _Stat)
227  {
228  _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat32));
229  return _stat32(_FileName, (struct _stat32*)_Stat);
230  }
231 
232  #else
233 
234  static __inline int __CRTDECL fstat(int const _FileHandle, struct stat* const _Stat)
235  {
236  _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat64i32));
237  return _fstat64i32(_FileHandle, (struct _stat64i32*)_Stat);
238  }
239  static __inline int __CRTDECL stat(char const* const _FileName, struct stat* const _Stat)
240  {
241  _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat64i32));
242  return _stat64i32(_FileName, (struct _stat64i32*)_Stat);
243  }
244 
245  #endif
246 #endif
247 
248 
249 #pragma warning(pop)
250 
251 
#define _Out_
Definition: sal.h:342
_dev_t st_rdev
Definition: stat.h:33
_ACRTIMP int __cdecl _wstat64i32(_In_z_ wchar_t const *_FileName, _Out_ struct _stat64i32 *_Stat)
_ino_t st_ino
Definition: stat.h:43
#define _ACRTIMP
Definition: corecrt.h:27
_dev_t st_dev
Definition: stat.h:72
__int64 st_size
Definition: stat.h:79
_ACRTIMP int __cdecl _wstat64(_In_z_ wchar_t const *_FileName, _Out_ struct _stat64 *_Stat)
__time32_t st_ctime
Definition: stat.h:52
__time32_t st_atime
Definition: stat.h:35
_ACRTIMP int __cdecl _stat64i32(_In_z_ char const *_FileName, _Out_ struct _stat64i32 *_Stat)
_ACRTIMP int __cdecl _stat32i64(_In_z_ char const *_FileName, _Out_ struct _stat32i64 *_Stat)
_dev_t st_dev
Definition: stat.h:42
_dev_t st_rdev
Definition: stat.h:63
short st_uid
Definition: stat.h:61
unsigned short st_mode
Definition: stat.h:74
unsigned short st_mode
Definition: stat.h:44
__time64_t st_atime
Definition: stat.h:80
__time32_t st_ctime
Definition: stat.h:37
__time32_t st_mtime
Definition: stat.h:51
_ACRTIMP int __cdecl _fstat64(_In_ int _FileHandle, _Out_ struct _stat64 *_Stat)
short st_gid
Definition: stat.h:32
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:73
_dev_t st_rdev
Definition: stat.h:48
_ACRTIMP int __cdecl _stat32(_In_z_ char const *_FileName, _Out_ struct _stat32 *_Stat)
_dev_t st_rdev
Definition: stat.h:78
short st_gid
Definition: stat.h:47
short st_uid
Definition: stat.h:46
#define __CRTDECL
Definition: vcruntime.h:156
__time64_t time_t
Definition: corecrt.h:517
__time64_t st_atime
Definition: stat.h:65
#define _In_z_
Definition: sal.h:310
#define _In_
Definition: sal.h:305
unsigned short _ino_t
Definition: types.h:15
short st_nlink
Definition: stat.h:60
long __time32_t
Definition: corecrt.h:479
_off_t st_size
Definition: stat.h:34
Definition: stat.h:70
__time64_t st_ctime
Definition: stat.h:82
short st_gid
Definition: stat.h:77
_dev_t st_dev
Definition: stat.h:57
__int64 st_size
Definition: stat.h:49
short st_nlink
Definition: stat.h:30
__time64_t st_mtime
Definition: stat.h:81
unsigned short st_mode
Definition: stat.h:29
short st_uid
Definition: stat.h:31
_ACRTIMP int __cdecl _stat64(_In_z_ char const *_FileName, _Out_ struct _stat64 *_Stat)
_In_opt_z_ wchar_t const _In_opt_z_ wchar_t const * _FileName
Definition: corecrt.h:253
#define _CRT_END_C_HEADER
Definition: vcruntime.h:76
unsigned int _dev_t
Definition: types.h:27
__time32_t st_mtime
Definition: stat.h:36
__time64_t st_mtime
Definition: stat.h:66
_ino_t st_ino
Definition: stat.h:73
__int64 __time64_t
Definition: corecrt.h:480
__time64_t st_ctime
Definition: stat.h:67
_ACRTIMP int __cdecl _wstat32(_In_z_ wchar_t const *_FileName, _Out_ struct _stat32 *_Stat)
_ino_t st_ino
Definition: stat.h:28
Definition: stat.h:55
short st_gid
Definition: stat.h:62
short st_uid
Definition: stat.h:76
unsigned short st_mode
Definition: stat.h:59
short st_nlink
Definition: stat.h:75
short st_nlink
Definition: stat.h:45
_STATIC_ASSERT(sizeof(unsigned int)<=_ALLOCA_S_MARKER_SIZE)
_ACRTIMP int __cdecl _fstat64i32(_In_ int _FileHandle, _Out_ struct _stat64i32 *_Stat)
_ACRTIMP int __cdecl _wstat32i64(_In_z_ wchar_t const *_FileName, _Out_ struct _stat32i64 *_Stat)
_ino_t st_ino
Definition: stat.h:58
Definition: stat.h:40
Definition: stat.h:25
_FS_DLL _File_type __CLRCALL_PURE_OR_CDECL _Stat(const wchar_t *, _Perms *)
_ACRTIMP int __cdecl _fstat32(_In_ int _FileHandle, _Out_ struct _stat32 *_Stat)
_dev_t st_dev
Definition: stat.h:27
_ACRTIMP int __cdecl _fstat32i64(_In_ int _FileHandle, _Out_ struct _stat32i64 *_Stat)
__time32_t st_atime
Definition: stat.h:50
_off_t st_size
Definition: stat.h:64
long _off_t
Definition: types.h:39