4 * Derived from the mingw header written by Colin Peters.
5 * Modified for Wine use by Jon Griffiths and Francois Gouget.
6 * This file is in the public domain.
8 #ifndef __WINE_SYS_STAT_H
9 #define __WINE_SYS_STAT_H
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
16 #include <sys/types.h>
18 #ifndef _WCHAR_T_DEFINED
19 #define _WCHAR_T_DEFINED
21 typedef unsigned short wchar_t;
27 # define __int64 long long
31 #ifndef _DEV_T_DEFINED
32 typedef unsigned int _dev_t;
33 #define _DEV_T_DEFINED
36 #ifndef _INO_T_DEFINED
37 typedef unsigned short _ino_t;
38 #define _INO_T_DEFINED
41 #ifndef _TIME_T_DEFINED
43 #define _TIME_T_DEFINED
46 #ifndef _OFF_T_DEFINED
48 #define _OFF_T_DEFINED
51 #ifndef DECLSPEC_ALIGN
52 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
53 # define DECLSPEC_ALIGN(x) __declspec(align(x))
54 # elif defined(__GNUC__)
55 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
57 # define DECLSPEC_ALIGN(x)
61 #define _S_IEXEC 0x0040
62 #define _S_IWRITE 0x0080
63 #define _S_IREAD 0x0100
64 #define _S_IFIFO 0x1000
65 #define _S_IFCHR 0x2000
66 #define _S_IFDIR 0x4000
67 #define _S_IFREG 0x8000
68 #define _S_IFMT 0xF000
81 unsigned short st_mode;
95 unsigned short st_mode;
109 unsigned short st_mode;
114 __int64 DECLSPEC_ALIGN(8) st_size;
123 unsigned short st_mode;
128 __int64 DECLSPEC_ALIGN(8) st_size;
133 #endif /* _STAT_DEFINED */
139 int _fstat(int,struct _stat*);
140 int _stat(const char*,struct _stat*);
141 int _fstati64(int,struct _stati64*);
142 int _stati64(const char*,struct _stati64*);
143 int _fstat64(int,struct _stat64*);
144 int _stat64(const char*,struct _stat64*);
147 #ifndef _WSTAT_DEFINED
148 #define _WSTAT_DEFINED
149 int _wstat(const wchar_t*,struct _stat*);
150 int _wstati64(const wchar_t*,struct _stati64*);
151 int _wstat64(const wchar_t*,struct _stat64*);
152 #endif /* _WSTAT_DEFINED */
159 #define S_IFMT _S_IFMT
160 #define S_IFDIR _S_IFDIR
161 #define S_IFCHR _S_IFCHR
162 #define S_IFREG _S_IFREG
163 #define S_IREAD _S_IREAD
164 #define S_IWRITE _S_IWRITE
165 #define S_IEXEC _S_IEXEC
167 #define S_ISCHR(m) (((m)&_S_IFMT) == _S_IFCHR)
168 #define S_ISDIR(m) (((m)&_S_IFMT) == _S_IFDIR)
169 #define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
170 #define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
172 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
173 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
174 #ifndef _UMASK_DEFINED
175 static inline int umask(int fd) { return _umask(fd); }
176 #define _UMASK_DEFINED
181 #endif /* __WINE_SYS_STAT_H */