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 #define __WINE_USE_MSVCRT
12 #include "sys/types.h"
15 # ifdef USE_MSVCRT_PREFIX
16 # define MSVCRT(x) MSVCRT_##x
22 #ifndef MSVCRT_WCHAR_T_DEFINED
23 #define MSVCRT_WCHAR_T_DEFINED
25 typedef unsigned short MSVCRT(wchar_t);
31 # define __int64 long long
35 #ifndef MSVCRT_DEV_T_DEFINED
36 typedef unsigned int _dev_t;
37 #define MSVCRT_DEV_T_DEFINED
40 #ifndef MSVCRT_INO_T_DEFINED
41 typedef unsigned short _ino_t;
42 #define MSVCRT_INO_T_DEFINED
45 #ifndef MSVCRT_TIME_T_DEFINED
46 typedef long MSVCRT(time_t);
47 #define MSVCRT_TIME_T_DEFINED
50 #ifndef MSVCRT_OFF_T_DEFINED
51 typedef int MSVCRT(_off_t);
52 #define MSVCRT_OFF_T_DEFINED
55 #define _S_IEXEC 0x0040
56 #define _S_IWRITE 0x0080
57 #define _S_IREAD 0x0100
58 #define _S_IFIFO 0x1000
59 #define _S_IFCHR 0x2000
60 #define _S_IFDIR 0x4000
61 #define _S_IFREG 0x8000
62 #define _S_IFMT 0xF000
69 #ifndef MSVCRT_STAT_DEFINED
70 #define MSVCRT_STAT_DEFINED
75 unsigned short st_mode;
80 MSVCRT(_off_t) st_size;
81 MSVCRT(time_t) st_atime;
82 MSVCRT(time_t) st_mtime;
83 MSVCRT(time_t) st_ctime;
89 unsigned short st_mode;
94 MSVCRT(_off_t) st_size;
95 MSVCRT(time_t) st_atime;
96 MSVCRT(time_t) st_mtime;
97 MSVCRT(time_t) st_ctime;
103 unsigned short st_mode;
109 MSVCRT(time_t) st_atime;
110 MSVCRT(time_t) st_mtime;
111 MSVCRT(time_t) st_ctime;
113 #endif /* MSVCRT_STAT_DEFINED */
119 int MSVCRT(_fstat)(int,struct _stat*);
120 int MSVCRT(_stat)(const char*,struct _stat*);
121 int _fstati64(int,struct _stati64*);
122 int _stati64(const char*,struct _stati64*);
125 #ifndef MSVCRT_WSTAT_DEFINED
126 #define MSVCRT_WSTAT_DEFINED
127 int _wstat(const MSVCRT(wchar_t)*,struct _stat*);
128 int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
129 #endif /* MSVCRT_WSTAT_DEFINED */
136 #ifndef USE_MSVCRT_PREFIX
137 #define S_IFMT _S_IFMT
138 #define S_IFDIR _S_IFDIR
139 #define S_IFCHR _S_IFCHR
140 #define S_IFREG _S_IFREG
141 #define S_IREAD _S_IREAD
142 #define S_IWRITE _S_IWRITE
143 #define S_IEXEC _S_IEXEC
145 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
146 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
147 #ifndef MSVCRT_UMASK_DEFINED
148 static inline int umask(int fd) { return _umask(fd); }
149 #define MSVCRT_UMASK_DEFINED
151 #endif /* USE_MSVCRT_PREFIX */
153 #endif /* __WINE_SYS_STAT_H */