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 <pshpack8.h>
15
16 #include <sys/types.h>
17
18 #ifndef _WCHAR_T_DEFINED
19 #define _WCHAR_T_DEFINED
20 #ifndef __cplusplus
21 typedef unsigned short wchar_t;
22 #endif
23 #endif
24
25 #ifndef _DEV_T_DEFINED
26 typedef unsigned int _dev_t;
27 #define _DEV_T_DEFINED
28 #endif
29
30 #ifndef _INO_T_DEFINED
31 typedef unsigned short _ino_t;
32 #define _INO_T_DEFINED
33 #endif
34
35 #ifndef _TIME_T_DEFINED
36 typedef long time_t;
37 #define _TIME_T_DEFINED
38 #endif
39
40 #ifndef _OFF_T_DEFINED
41 typedef int _off_t;
42 #define _OFF_T_DEFINED
43 #endif
44
45 #ifndef DECLSPEC_ALIGN
46 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
47 # define DECLSPEC_ALIGN(x) __declspec(align(x))
48 # elif defined(__GNUC__)
49 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
50 # else
51 # define DECLSPEC_ALIGN(x)
52 # endif
53 #endif
54
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
63
64 /* for FreeBSD */
65 #undef st_atime
66 #undef st_ctime
67 #undef st_mtime
68
69 #ifndef _STAT_DEFINED
70 #define _STAT_DEFINED
71
72 struct _stat {
73 _dev_t st_dev;
74 _ino_t st_ino;
75 unsigned short st_mode;
76 short st_nlink;
77 short st_uid;
78 short st_gid;
79 _dev_t st_rdev;
80 _off_t st_size;
81 time_t st_atime;
82 time_t st_mtime;
83 time_t st_ctime;
84 };
85
86 struct stat {
87 _dev_t st_dev;
88 _ino_t st_ino;
89 unsigned short st_mode;
90 short st_nlink;
91 short st_uid;
92 short st_gid;
93 _dev_t st_rdev;
94 _off_t st_size;
95 time_t st_atime;
96 time_t st_mtime;
97 time_t st_ctime;
98 };
99
100 struct _stati64 {
101 _dev_t st_dev;
102 _ino_t st_ino;
103 unsigned short st_mode;
104 short st_nlink;
105 short st_uid;
106 short st_gid;
107 _dev_t st_rdev;
108 __int64 DECLSPEC_ALIGN(8) st_size;
109 time_t st_atime;
110 time_t st_mtime;
111 time_t st_ctime;
112 };
113
114 struct _stat64 {
115 _dev_t st_dev;
116 _ino_t st_ino;
117 unsigned short st_mode;
118 short st_nlink;
119 short st_uid;
120 short st_gid;
121 _dev_t st_rdev;
122 __int64 DECLSPEC_ALIGN(8) st_size;
123 __time64_t st_atime;
124 __time64_t st_mtime;
125 __time64_t st_ctime;
126 };
127 #endif /* _STAT_DEFINED */
128
129 #ifdef __cplusplus
130 extern "C" {
131 #endif
132
133 int _fstat(int,struct _stat*);
134 int _stat(const char*,struct _stat*);
135 int _fstati64(int,struct _stati64*);
136 int _stati64(const char*,struct _stati64*);
137 int _fstat64(int,struct _stat64*);
138 int _stat64(const char*,struct _stat64*);
139 int _umask(int);
140
141 #ifndef _WSTAT_DEFINED
142 #define _WSTAT_DEFINED
143 int _wstat(const wchar_t*,struct _stat*);
144 int _wstati64(const wchar_t*,struct _stati64*);
145 int _wstat64(const wchar_t*,struct _stat64*);
146 #endif /* _WSTAT_DEFINED */
147
148 #ifdef __cplusplus
149 }
150 #endif
151
152
153 #define S_IFMT _S_IFMT
154 #define S_IFDIR _S_IFDIR
155 #define S_IFCHR _S_IFCHR
156 #define S_IFREG _S_IFREG
157 #define S_IREAD _S_IREAD
158 #define S_IWRITE _S_IWRITE
159 #define S_IEXEC _S_IEXEC
160
161 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
162 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
163 #ifndef _UMASK_DEFINED
164 static inline int umask(int fd) { return _umask(fd); }
165 #define _UMASK_DEFINED
166 #endif
167
168 #include <poppack.h>
169
170 #endif /* __WINE_SYS_STAT_H */
171
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.