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>
17 # ifdef USE_MSVCRT_PREFIX
18 # define MSVCRT(x) MSVCRT_##x
24 #ifndef MSVCRT_WCHAR_T_DEFINED
25 #define MSVCRT_WCHAR_T_DEFINED
27 typedef unsigned short MSVCRT(wchar_t);
33 # define __int64 long long
37 #ifndef MSVCRT_DEV_T_DEFINED
38 typedef unsigned int _dev_t;
39 #define MSVCRT_DEV_T_DEFINED
42 #ifndef MSVCRT_INO_T_DEFINED
43 typedef unsigned short _ino_t;
44 #define MSVCRT_INO_T_DEFINED
47 #ifndef MSVCRT_TIME_T_DEFINED
48 typedef long MSVCRT(time_t);
49 #define MSVCRT_TIME_T_DEFINED
52 #ifndef MSVCRT_OFF_T_DEFINED
53 typedef int MSVCRT(_off_t);
54 #define MSVCRT_OFF_T_DEFINED
57 #define _S_IEXEC 0x0040
58 #define _S_IWRITE 0x0080
59 #define _S_IREAD 0x0100
60 #define _S_IFIFO 0x1000
61 #define _S_IFCHR 0x2000
62 #define _S_IFDIR 0x4000
63 #define _S_IFREG 0x8000
64 #define _S_IFMT 0xF000
71 #ifndef MSVCRT_STAT_DEFINED
72 #define MSVCRT_STAT_DEFINED
77 unsigned short st_mode;
82 MSVCRT(_off_t) st_size;
83 MSVCRT(time_t) st_atime;
84 MSVCRT(time_t) st_mtime;
85 MSVCRT(time_t) st_ctime;
91 unsigned short st_mode;
96 MSVCRT(_off_t) st_size;
97 MSVCRT(time_t) st_atime;
98 MSVCRT(time_t) st_mtime;
99 MSVCRT(time_t) st_ctime;
105 unsigned short st_mode;
111 MSVCRT(time_t) st_atime;
112 MSVCRT(time_t) st_mtime;
113 MSVCRT(time_t) st_ctime;
115 #endif /* MSVCRT_STAT_DEFINED */
121 int MSVCRT(_fstat)(int,struct _stat*);
122 int MSVCRT(_stat)(const char*,struct _stat*);
123 int _fstati64(int,struct _stati64*);
124 int _stati64(const char*,struct _stati64*);
127 #ifndef MSVCRT_WSTAT_DEFINED
128 #define MSVCRT_WSTAT_DEFINED
129 int _wstat(const MSVCRT(wchar_t)*,struct _stat*);
130 int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
131 #endif /* MSVCRT_WSTAT_DEFINED */
138 #ifndef USE_MSVCRT_PREFIX
139 #define S_IFMT _S_IFMT
140 #define S_IFDIR _S_IFDIR
141 #define S_IFCHR _S_IFCHR
142 #define S_IFREG _S_IFREG
143 #define S_IREAD _S_IREAD
144 #define S_IWRITE _S_IWRITE
145 #define S_IEXEC _S_IEXEC
147 #define S_ISCHR(m) (((m)&_S_IFMT) == _S_IFCHR)
148 #define S_ISDIR(m) (((m)&_S_IFMT) == _S_IFDIR)
149 #define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
150 #define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
152 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
153 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
154 #ifndef MSVCRT_UMASK_DEFINED
155 static inline int umask(int fd) { return _umask(fd); }
156 #define MSVCRT_UMASK_DEFINED
158 #endif /* USE_MSVCRT_PREFIX */
160 #endif /* __WINE_SYS_STAT_H */