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
14 #include <sys/types.h>
16 #ifndef _WCHAR_T_DEFINED
17 #define _WCHAR_T_DEFINED
19 typedef unsigned short wchar_t;
25 # define __int64 long long
29 #ifndef _DEV_T_DEFINED
30 typedef unsigned int _dev_t;
31 #define _DEV_T_DEFINED
34 #ifndef _INO_T_DEFINED
35 typedef unsigned short _ino_t;
36 #define _INO_T_DEFINED
39 #ifndef _TIME_T_DEFINED
41 #define _TIME_T_DEFINED
44 #ifndef _OFF_T_DEFINED
46 #define _OFF_T_DEFINED
49 #ifndef DECLSPEC_ALIGN
50 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
51 # define DECLSPEC_ALIGN(x) __declspec(align(x))
52 # elif defined(__GNUC__)
53 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
55 # define DECLSPEC_ALIGN(x)
59 #define _S_IEXEC 0x0040
60 #define _S_IWRITE 0x0080
61 #define _S_IREAD 0x0100
62 #define _S_IFIFO 0x1000
63 #define _S_IFCHR 0x2000
64 #define _S_IFDIR 0x4000
65 #define _S_IFREG 0x8000
66 #define _S_IFMT 0xF000
79 unsigned short st_mode;
93 unsigned short st_mode;
107 unsigned short st_mode;
112 __int64 DECLSPEC_ALIGN(8) st_size;
117 #endif /* _STAT_DEFINED */
123 int _fstat(int,struct _stat*);
124 int _stat(const char*,struct _stat*);
125 int _fstati64(int,struct _stati64*);
126 int _stati64(const char*,struct _stati64*);
129 #ifndef _WSTAT_DEFINED
130 #define _WSTAT_DEFINED
131 int _wstat(const wchar_t*,struct _stat*);
132 int _wstati64(const wchar_t*,struct _stati64*);
133 #endif /* _WSTAT_DEFINED */
140 #define S_IFMT _S_IFMT
141 #define S_IFDIR _S_IFDIR
142 #define S_IFCHR _S_IFCHR
143 #define S_IFREG _S_IFREG
144 #define S_IREAD _S_IREAD
145 #define S_IWRITE _S_IWRITE
146 #define S_IEXEC _S_IEXEC
148 #define S_ISCHR(m) (((m)&_S_IFMT) == _S_IFCHR)
149 #define S_ISDIR(m) (((m)&_S_IFMT) == _S_IFDIR)
150 #define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
151 #define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
153 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
154 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
155 #ifndef _UMASK_DEFINED
156 static inline int umask(int fd) { return _umask(fd); }
157 #define _UMASK_DEFINED
160 #endif /* __WINE_SYS_STAT_H */