kernel32: CreateThread returns NULL on error, not INVALID_HANDLE_VALUE.
[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 _WCHAR_T_DEFINED
17 #define _WCHAR_T_DEFINED
18 #ifndef __cplusplus
19 typedef unsigned short wchar_t;
20 #endif
21 #endif
22
23 #ifndef _MSC_VER
24 # ifndef __int64
25 #  define __int64 long long
26 # endif
27 #endif
28
29 #ifndef _DEV_T_DEFINED
30 typedef unsigned int _dev_t;
31 #define _DEV_T_DEFINED
32 #endif
33
34 #ifndef _INO_T_DEFINED
35 typedef unsigned short _ino_t;
36 #define _INO_T_DEFINED
37 #endif
38
39 #ifndef _TIME_T_DEFINED
40 typedef long time_t;
41 #define _TIME_T_DEFINED
42 #endif
43
44 #ifndef _OFF_T_DEFINED
45 typedef int _off_t;
46 #define _OFF_T_DEFINED
47 #endif
48
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)))
54 # else
55 #  define DECLSPEC_ALIGN(x)
56 # endif
57 #endif
58
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
67
68 /* for FreeBSD */
69 #undef st_atime
70 #undef st_ctime
71 #undef st_mtime
72
73 #ifndef _STAT_DEFINED
74 #define _STAT_DEFINED
75
76 struct _stat {
77   _dev_t st_dev;
78   _ino_t st_ino;
79   unsigned short st_mode;
80   short          st_nlink;
81   short          st_uid;
82   short          st_gid;
83   _dev_t st_rdev;
84   _off_t st_size;
85   time_t st_atime;
86   time_t st_mtime;
87   time_t st_ctime;
88 };
89
90 struct stat {
91   _dev_t st_dev;
92   _ino_t st_ino;
93   unsigned short st_mode;
94   short          st_nlink;
95   short          st_uid;
96   short          st_gid;
97   _dev_t st_rdev;
98   _off_t st_size;
99   time_t st_atime;
100   time_t st_mtime;
101   time_t st_ctime;
102 };
103
104 struct _stati64 {
105   _dev_t st_dev;
106   _ino_t st_ino;
107   unsigned short st_mode;
108   short          st_nlink;
109   short          st_uid;
110   short          st_gid;
111   _dev_t st_rdev;
112   __int64 DECLSPEC_ALIGN(8) st_size;
113   time_t st_atime;
114   time_t st_mtime;
115   time_t st_ctime;
116 };
117 #endif /* _STAT_DEFINED */
118
119 #ifdef __cplusplus
120 extern "C" {
121 #endif
122
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*);
127 int _umask(int);
128
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 */
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139
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
147
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)
152
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
158 #endif
159
160 #endif /* __WINE_SYS_STAT_H */