include: Add the msvcrt/crtdefs.h header and include it where needed.
[wine/wine64.git] / include / msvcrt / sys / stat.h
blobc29daf68e07546f6afd494d1b6d0cf358d4f1764
1 /*
2 * _stat() definitions
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
11 #include <crtdefs.h>
12 #include <sys/types.h>
14 #include <pshpack8.h>
16 #ifndef _DEV_T_DEFINED
17 typedef unsigned int _dev_t;
18 #define _DEV_T_DEFINED
19 #endif
21 #ifndef _INO_T_DEFINED
22 typedef unsigned short _ino_t;
23 #define _INO_T_DEFINED
24 #endif
26 #ifndef _OFF_T_DEFINED
27 typedef int _off_t;
28 #define _OFF_T_DEFINED
29 #endif
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
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
50 /* for FreeBSD */
51 #undef st_atime
52 #undef st_ctime
53 #undef st_mtime
55 #ifndef _STAT_DEFINED
56 #define _STAT_DEFINED
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;
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;
86 struct _stati64 {
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 __int64 DECLSPEC_ALIGN(8) st_size;
95 time_t st_atime;
96 time_t st_mtime;
97 time_t st_ctime;
100 struct _stat64 {
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 __time64_t st_atime;
110 __time64_t st_mtime;
111 __time64_t st_ctime;
113 #endif /* _STAT_DEFINED */
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
119 int _fstat(int,struct _stat*);
120 int _stat(const char*,struct _stat*);
121 int _fstati64(int,struct _stati64*);
122 int _stati64(const char*,struct _stati64*);
123 int _fstat64(int,struct _stat64*);
124 int _stat64(const char*,struct _stat64*);
125 int _umask(int);
127 #ifndef _WSTAT_DEFINED
128 #define _WSTAT_DEFINED
129 int _wstat(const wchar_t*,struct _stat*);
130 int _wstati64(const wchar_t*,struct _stati64*);
131 int _wstat64(const wchar_t*,struct _stat64*);
132 #endif /* _WSTAT_DEFINED */
134 #ifdef __cplusplus
136 #endif
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
147 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
148 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
149 #ifndef _UMASK_DEFINED
150 static inline int umask(int fd) { return _umask(fd); }
151 #define _UMASK_DEFINED
152 #endif
154 #include <poppack.h>
156 #endif /* __WINE_SYS_STAT_H */