Fix subclassing to support nested messages.
[wine] / include / msvcrt / sys / stat.h
1 /*
2  * _stat() definitions
3  *
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.
7  */
8 #ifndef __WINE_SYS_STAT_H
9 #define __WINE_SYS_STAT_H
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
12 #endif
13
14 #include <sys/types.h>
15
16 #ifndef MSVCRT
17 # ifdef USE_MSVCRT_PREFIX
18 #  define MSVCRT(x)    MSVCRT_##x
19 # else
20 #  define MSVCRT(x)    x
21 # endif
22 #endif
23
24 #ifndef MSVCRT_WCHAR_T_DEFINED
25 #define MSVCRT_WCHAR_T_DEFINED
26 #ifndef __cplusplus
27 typedef unsigned short MSVCRT(wchar_t);
28 #endif
29 #endif
30
31 #ifndef _MSC_VER
32 # ifndef __int64
33 #  define __int64 long long
34 # endif
35 #endif
36
37 #ifndef MSVCRT_DEV_T_DEFINED
38 typedef unsigned int   _dev_t;
39 #define MSVCRT_DEV_T_DEFINED
40 #endif
41
42 #ifndef MSVCRT_INO_T_DEFINED
43 typedef unsigned short _ino_t;
44 #define MSVCRT_INO_T_DEFINED
45 #endif
46
47 #ifndef MSVCRT_TIME_T_DEFINED
48 typedef long MSVCRT(time_t);
49 #define MSVCRT_TIME_T_DEFINED
50 #endif
51
52 #ifndef MSVCRT_OFF_T_DEFINED
53 typedef int MSVCRT(_off_t);
54 #define MSVCRT_OFF_T_DEFINED
55 #endif
56
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
65
66 /* for FreeBSD */
67 #undef st_atime
68 #undef st_ctime
69 #undef st_mtime
70
71 #ifndef MSVCRT_STAT_DEFINED
72 #define MSVCRT_STAT_DEFINED
73
74 struct _stat {
75   _dev_t         st_dev;
76   _ino_t         st_ino;
77   unsigned short st_mode;
78   short          st_nlink;
79   short          st_uid;
80   short          st_gid;
81   _dev_t         st_rdev;
82   MSVCRT(_off_t) st_size;
83   MSVCRT(time_t) st_atime;
84   MSVCRT(time_t) st_mtime;
85   MSVCRT(time_t) st_ctime;
86 };
87
88 struct MSVCRT(stat) {
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   MSVCRT(_off_t) st_size;
97   MSVCRT(time_t) st_atime;
98   MSVCRT(time_t) st_mtime;
99   MSVCRT(time_t) st_ctime;
100 };
101
102 struct _stati64 {
103   _dev_t         st_dev;
104   _ino_t         st_ino;
105   unsigned short st_mode;
106   short          st_nlink;
107   short          st_uid;
108   short          st_gid;
109   _dev_t         st_rdev;
110   __int64        st_size;
111   MSVCRT(time_t) st_atime;
112   MSVCRT(time_t) st_mtime;
113   MSVCRT(time_t) st_ctime;
114 };
115 #endif /* MSVCRT_STAT_DEFINED */
116
117 #ifdef __cplusplus
118 extern "C" {
119 #endif
120
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*);
125 int _umask(int);
126
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 */
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137
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
146
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)
151
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
157 #endif
158 #endif /* USE_MSVCRT_PREFIX */
159
160 #endif /* __WINE_SYS_STAT_H */