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 |
|
---|
11 | #include <crtdefs.h>
|
---|
12 | #include <sys/types.h>
|
---|
13 |
|
---|
14 | #include <pshpack8.h>
|
---|
15 |
|
---|
16 | #ifndef _DEV_T_DEFINED
|
---|
17 | typedef unsigned int _dev_t;
|
---|
18 | #define _DEV_T_DEFINED
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | #ifndef _INO_T_DEFINED
|
---|
22 | typedef unsigned short _ino_t;
|
---|
23 | #define _INO_T_DEFINED
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | #ifndef _OFF_T_DEFINED
|
---|
27 | typedef int _off_t;
|
---|
28 | #define _OFF_T_DEFINED
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #ifndef DECLSPEC_ALIGN
|
---|
32 | # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
|
---|
33 | # define DECLSPEC_ALIGN(x) __declspec(align(x))
|
---|
34 | # elif defined(__GNUC__)
|
---|
35 | # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
|
---|
36 | # else
|
---|
37 | # define DECLSPEC_ALIGN(x)
|
---|
38 | # endif
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #define _S_IEXEC 0x0040
|
---|
42 | #define _S_IWRITE 0x0080
|
---|
43 | #define _S_IREAD 0x0100
|
---|
44 | #define _S_IFIFO 0x1000
|
---|
45 | #define _S_IFCHR 0x2000
|
---|
46 | #define _S_IFDIR 0x4000
|
---|
47 | #define _S_IFREG 0x8000
|
---|
48 | #define _S_IFMT 0xF000
|
---|
49 |
|
---|
50 | /* for FreeBSD */
|
---|
51 | #undef st_atime
|
---|
52 | #undef st_ctime
|
---|
53 | #undef st_mtime
|
---|
54 |
|
---|
55 | #ifndef _STAT_DEFINED
|
---|
56 | #define _STAT_DEFINED
|
---|
57 |
|
---|
58 | struct _stat {
|
---|
59 | _dev_t st_dev;
|
---|
60 | _ino_t st_ino;
|
---|
61 | unsigned short st_mode;
|
---|
62 | short st_nlink;
|
---|
63 | short st_uid;
|
---|
64 | short st_gid;
|
---|
65 | _dev_t st_rdev;
|
---|
66 | _off_t st_size;
|
---|
67 | time_t st_atime;
|
---|
68 | time_t st_mtime;
|
---|
69 | time_t st_ctime;
|
---|
70 | };
|
---|
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 _stat32 {
|
---|
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 | __time32_t st_atime;
|
---|
96 | __time32_t st_mtime;
|
---|
97 | __time32_t st_ctime;
|
---|
98 | };
|
---|
99 |
|
---|
100 | struct _stat32i64 {
|
---|
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 _stat64i32 {
|
---|
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 | _off_t st_size;
|
---|
123 | __time64_t st_atime;
|
---|
124 | __time64_t st_mtime;
|
---|
125 | __time64_t st_ctime;
|
---|
126 | };
|
---|
127 |
|
---|
128 | struct _stati64 {
|
---|
129 | _dev_t st_dev;
|
---|
130 | _ino_t st_ino;
|
---|
131 | unsigned short st_mode;
|
---|
132 | short st_nlink;
|
---|
133 | short st_uid;
|
---|
134 | short st_gid;
|
---|
135 | _dev_t st_rdev;
|
---|
136 | __int64 DECLSPEC_ALIGN(8) st_size;
|
---|
137 | time_t st_atime;
|
---|
138 | time_t st_mtime;
|
---|
139 | time_t st_ctime;
|
---|
140 | };
|
---|
141 |
|
---|
142 | struct _stat64 {
|
---|
143 | _dev_t st_dev;
|
---|
144 | _ino_t st_ino;
|
---|
145 | unsigned short st_mode;
|
---|
146 | short st_nlink;
|
---|
147 | short st_uid;
|
---|
148 | short st_gid;
|
---|
149 | _dev_t st_rdev;
|
---|
150 | __int64 DECLSPEC_ALIGN(8) st_size;
|
---|
151 | __time64_t st_atime;
|
---|
152 | __time64_t st_mtime;
|
---|
153 | __time64_t st_ctime;
|
---|
154 | };
|
---|
155 | #endif /* _STAT_DEFINED */
|
---|
156 |
|
---|
157 | #ifdef __cplusplus
|
---|
158 | extern "C" {
|
---|
159 | #endif
|
---|
160 |
|
---|
161 | int __cdecl _fstat(int,struct _stat*);
|
---|
162 | int __cdecl _stat(const char*,struct _stat*);
|
---|
163 | int __cdecl _fstat32(int, struct _stat32*);
|
---|
164 | int __cdecl _stat32(const char*, struct _stat32*);
|
---|
165 | int __cdecl _fstati64(int,struct _stati64*);
|
---|
166 | int __cdecl _stati64(const char*,struct _stati64*);
|
---|
167 | int __cdecl _fstat64(int,struct _stat64*);
|
---|
168 | int __cdecl _stat64(const char*,struct _stat64*);
|
---|
169 | int __cdecl _umask(int);
|
---|
170 |
|
---|
171 | #ifndef _WSTAT_DEFINED
|
---|
172 | #define _WSTAT_DEFINED
|
---|
173 | int __cdecl _wstat(const wchar_t*,struct _stat*);
|
---|
174 | int __cdecl _wstat32(const wchar_t*, struct _stat32*);
|
---|
175 | int __cdecl _wstati64(const wchar_t*,struct _stati64*);
|
---|
176 | int __cdecl _wstat64(const wchar_t*,struct _stat64*);
|
---|
177 | #endif /* _WSTAT_DEFINED */
|
---|
178 |
|
---|
179 | #ifdef __cplusplus
|
---|
180 | }
|
---|
181 | #endif
|
---|
182 |
|
---|
183 |
|
---|
184 | #define S_IFMT _S_IFMT
|
---|
185 | #define S_IFDIR _S_IFDIR
|
---|
186 | #define S_IFCHR _S_IFCHR
|
---|
187 | #define S_IFREG _S_IFREG
|
---|
188 | #define S_IREAD _S_IREAD
|
---|
189 | #define S_IWRITE _S_IWRITE
|
---|
190 | #define S_IEXEC _S_IEXEC
|
---|
191 |
|
---|
192 | static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
|
---|
193 | static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
|
---|
194 | #ifndef _UMASK_DEFINED
|
---|
195 | static inline int umask(int fd) { return _umask(fd); }
|
---|
196 | #define _UMASK_DEFINED
|
---|
197 | #endif
|
---|
198 |
|
---|
199 | #include <poppack.h>
|
---|
200 |
|
---|
201 | #endif /* __WINE_SYS_STAT_H */
|
---|