ReactOS 0.4.16-dev-983-g23ad936
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
13#pragma warning(push)
14#pragma warning(disable: _UCRT_DISABLED_WARNINGS)
16
18
19//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20//
21// Types
22//
23//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
24struct _stat32
25{
28 unsigned short st_mode;
29 short st_nlink;
30 short st_uid;
31 short st_gid;
37};
38
40{
43 unsigned short st_mode;
44 short st_nlink;
45 short st_uid;
46 short st_gid;
52};
53
55{
58 unsigned short st_mode;
59 short st_nlink;
60 short st_uid;
61 short st_gid;
67};
68
69struct _stat64
70{
73 unsigned short st_mode;
74 short st_nlink;
75 short st_uid;
76 short st_gid;
82};
83
84#define __stat64 _stat64 // For legacy compatibility
85
86#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined _CRT_NO_TIME_T
87 struct stat
88 {
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 _off_t st_size;
97 time_t st_atime;
98 time_t st_mtime;
99 time_t st_ctime;
100 };
101#endif
102
103
104
105//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
106//
107// Flags
108//
109//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
110#define _S_IFMT 0xF000 // File type mask
111#define _S_IFDIR 0x4000 // Directory
112#define _S_IFCHR 0x2000 // Character special
113#define _S_IFIFO 0x1000 // Pipe
114#define _S_IFREG 0x8000 // Regular
115#define _S_IREAD 0x0100 // Read permission, owner
116#define _S_IWRITE 0x0080 // Write permission, owner
117#define _S_IEXEC 0x0040 // Execute/search permission, owner
118
119#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES
120 #define S_IFMT _S_IFMT
121 #define S_IFDIR _S_IFDIR
122 #define S_IFCHR _S_IFCHR
123 #define S_IFREG _S_IFREG
124 #define S_IREAD _S_IREAD
125 #define S_IWRITE _S_IWRITE
126 #define S_IEXEC _S_IEXEC
127#endif
128
129
130
131//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
132//
133// Functions
134//
135//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
136#ifdef _USE_32BIT_TIME_T
137 #define _fstat _fstat32
138 #define _fstati64 _fstat32i64
139 #define _stat _stat32
140 #define _stati64 _stat32i64
141 #define _wstat _wstat32
142 #define _wstati64 _wstat32i64
143#else
144 #define _fstat _fstat64i32
145 #define _fstati64 _fstat64
146 #define _stat _stat64i32
147 #define _stati64 _stat64
148 #define _wstat _wstat64i32
149 #define _wstati64 _wstat64
150#endif
151
152
153
155 _In_ int _FileHandle,
156 _Out_ struct _stat32* _Stat
157 );
158
160 _In_ int _FileHandle,
161 _Out_ struct _stat32i64* _Stat
162 );
163
165 _In_ int _FileHandle,
166 _Out_ struct _stat64i32* _Stat
167 );
168
170 _In_ int _FileHandle,
171 _Out_ struct _stat64* _Stat
172 );
173
175 _In_z_ char const* _FileName,
176 _Out_ struct _stat32* _Stat
177 );
178
180 _In_z_ char const* _FileName,
181 _Out_ struct _stat32i64* _Stat
182 );
183
185 _In_z_ char const* _FileName,
186 _Out_ struct _stat64i32* _Stat
187 );
188
190 _In_z_ char const* _FileName,
191 _Out_ struct _stat64* _Stat
192 );
193
195 _In_z_ wchar_t const* _FileName,
196 _Out_ struct _stat32* _Stat
197 );
198
200 _In_z_ wchar_t const* _FileName,
201 _Out_ struct _stat32i64* _Stat
202 );
203
205 _In_z_ wchar_t const* _FileName,
206 _Out_ struct _stat64i32* _Stat
207 );
208
210 _In_z_ wchar_t const* _FileName,
211 _Out_ struct _stat64* _Stat
212 );
213
214
215
216#if !defined RC_INVOKED && !defined __midl && defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined _CRT_NO_TIME_T
217 #ifdef _USE_32BIT_TIME_T
218
219 static __inline int __CRTDECL fstat(int const _FileHandle, struct stat* const _Stat)
220 {
221 _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat32));
222 return _fstat32(_FileHandle, (struct _stat32*)_Stat);
223 }
224
225 static __inline int __CRTDECL stat(char const* const _FileName, struct stat* const _Stat)
226 {
227 _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat32));
228 return _stat32(_FileName, (struct _stat32*)_Stat);
229 }
230
231 #else
232
233 static __inline int __CRTDECL fstat(int const _FileHandle, struct stat* const _Stat)
234 {
235 _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat64i32));
236 return _fstat64i32(_FileHandle, (struct _stat64i32*)_Stat);
237 }
238 static __inline int __CRTDECL stat(char const* const _FileName, struct stat* const _Stat)
239 {
240 _STATIC_ASSERT(sizeof(struct stat) == sizeof(struct _stat64i32));
241 return _stat64i32(_FileName, (struct _stat64i32*)_Stat);
242 }
243
244 #endif
245#endif
246
249#pragma warning(pop) // _UCRT_DISABLED_WARNINGS
#define __inline
Definition: _wctype.cpp:15
#define __cdecl
Definition: accygwin.h:79
#define stat
Definition: acwin.h:99
#define fstat
Definition: acwin.h:100
#define __int64
Definition: basetyps.h:16
_Out_ int * _FileHandle
st_mode
Definition: cpu_i386.c:139
__kernel_time_t time_t
Definition: linux.h:252
long _off_t
Definition: stdio.h:73
__CRT_INLINE int __cdecl _fstat32i64(int _FileDes, struct _stat32i64 *_Stat)
Definition: stat.h:287
_CRTIMP int __cdecl _wstat32(_In_z_ const wchar_t *_Name, _Out_ struct _stat32 *_Stat)
#define _fstat64i32
Definition: stat.h:269
_CRTIMP int __cdecl _fstat32(_In_ int _FileDes, _Out_ struct _stat32 *_Stat)
_ACRTIMP int __cdecl _wstat64i32(_In_z_ wchar_t const *_FileName, _Out_ struct _stat64i32 *_Stat)
_ACRTIMP int __cdecl _wstat64(_In_z_ wchar_t const *_FileName, _Out_ struct _stat64 *_Stat)
_ACRTIMP int __cdecl _fstat64(_In_ int _FileHandle, _Out_ struct _stat64 *_Stat)
_ACRTIMP int __cdecl _wstat32i64(_In_z_ wchar_t const *_FileName, _Out_ struct _stat32i64 *_Stat)
#define _In_z_
Definition: no_sal2.h:164
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
unsigned short _ino_t
Definition: types.h:17
unsigned int _dev_t
Definition: types.h:25
long __time32_t
Definition: time.h:24
Definition: stat.h:26
short st_uid
Definition: stat.h:31
_dev_t st_rdev
Definition: stat.h:33
short st_gid
Definition: stat.h:32
unsigned short st_mode
Definition: stat.h:29
__time32_t st_mtime
Definition: stat.h:36
_dev_t st_dev
Definition: stat.h:27
__time32_t st_ctime
Definition: stat.h:37
_ino_t st_ino
Definition: stat.h:28
__time32_t st_atime
Definition: stat.h:35
short st_nlink
Definition: stat.h:30
_off_t st_size
Definition: stat.h:34
short st_uid
Definition: stat.h:45
_ino_t st_ino
Definition: stat.h:42
_dev_t st_rdev
Definition: stat.h:47
unsigned short st_mode
Definition: stat.h:43
short st_nlink
Definition: stat.h:44
short st_gid
Definition: stat.h:46
_dev_t st_dev
Definition: stat.h:41
__time32_t st_ctime
Definition: stat.h:51
__int64 st_size
Definition: stat.h:48
__time32_t st_atime
Definition: stat.h:49
__time32_t st_mtime
Definition: stat.h:50
Definition: stat.h:70
__int64 st_size
Definition: stat.h:78
__time64_t st_ctime
Definition: stat.h:81
__time64_t st_mtime
Definition: stat.h:80
short st_uid
Definition: stat.h:75
__time64_t st_atime
Definition: stat.h:79
_dev_t st_dev
Definition: stat.h:71
short st_gid
Definition: stat.h:76
unsigned short st_mode
Definition: stat.h:73
short st_nlink
Definition: stat.h:74
_dev_t st_rdev
Definition: stat.h:77
_ino_t st_ino
Definition: stat.h:72
__time64_t st_mtime
Definition: stat.h:65
_dev_t st_dev
Definition: stat.h:56
_off_t st_size
Definition: stat.h:63
short st_nlink
Definition: stat.h:59
__time64_t st_ctime
Definition: stat.h:66
short st_gid
Definition: stat.h:61
short st_uid
Definition: stat.h:60
_dev_t st_rdev
Definition: stat.h:62
unsigned short st_mode
Definition: stat.h:58
__time64_t st_atime
Definition: stat.h:64
_ino_t st_ino
Definition: stat.h:57
Definition: stat.h:55
#define _STATIC_ASSERT(expr)
Definition: corecrt.h:305
__int64 __time64_t
Definition: corecrt.h:619
#define _ACRTIMP
Definition: corecrt.h:138
#define _UCRT_DISABLE_CLANG_WARNINGS
Definition: corecrt.h:109
#define _UCRT_RESTORE_CLANG_WARNINGS
Definition: corecrt.h:117
#define _CRT_END_C_HEADER
Definition: vcruntime.h:42
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:40
#define __CRTDECL
Definition: yvals.h:17