push 3cf4bc9cdb38c4fc36232fe19b9b904fd4d068e9
[wine/hacks.git] / include / msvcrt / io.h
blob0b411faea510a2508525007dbe1bb824386b4287
1 /*
2 * System I/O 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_IO_H
9 #define __WINE_IO_H
11 #include <crtdefs.h>
13 #include <pshpack8.h>
15 /* The following are also defined in dos.h */
16 #define _A_NORMAL 0x00000000
17 #define _A_RDONLY 0x00000001
18 #define _A_HIDDEN 0x00000002
19 #define _A_SYSTEM 0x00000004
20 #define _A_VOLID 0x00000008
21 #define _A_SUBDIR 0x00000010
22 #define _A_ARCH 0x00000020
24 #ifndef _FSIZE_T_DEFINED
25 typedef unsigned long _fsize_t;
26 #define _FSIZE_T_DEFINED
27 #endif
29 #ifndef _FINDDATA_T_DEFINED
30 #define _FINDDATA_T_DEFINED
31 struct _finddata_t
33 unsigned attrib;
34 time_t time_create;
35 time_t time_access;
36 time_t time_write;
37 _fsize_t size;
38 char name[260];
41 struct _finddatai64_t
43 unsigned attrib;
44 time_t time_create;
45 time_t time_access;
46 time_t time_write;
47 __int64 size;
48 char name[260];
50 #endif /* _FINDDATA_T_DEFINED */
52 #ifndef _WFINDDATA_T_DEFINED
53 #define _WFINDDATA_T_DEFINED
54 struct _wfinddata_t {
55 unsigned attrib;
56 time_t time_create;
57 time_t time_access;
58 time_t time_write;
59 _fsize_t size;
60 wchar_t name[260];
63 struct _wfinddatai64_t {
64 unsigned attrib;
65 time_t time_create;
66 time_t time_access;
67 time_t time_write;
68 __int64 size;
69 wchar_t name[260];
71 #endif /* _WFINDDATA_T_DEFINED */
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
77 int _access(const char*,int);
78 int _chmod(const char*,int);
79 int _chsize(int,long);
80 int _close(int);
81 int _commit(int);
82 int _creat(const char*,int);
83 int _dup(int);
84 int _dup2(int,int);
85 int _eof(int);
86 __int64 _filelengthi64(int);
87 long _filelength(int);
88 int _findclose(intptr_t);
89 intptr_t _findfirst(const char*,struct _finddata_t*);
90 intptr_t _findfirsti64(const char*, struct _finddatai64_t*);
91 int _findnext(intptr_t,struct _finddata_t*);
92 int _findnexti64(intptr_t, struct _finddatai64_t*);
93 intptr_t _get_osfhandle(int);
94 int _isatty(int);
95 int _locking(int,int,long);
96 long _lseek(int,long,int);
97 __int64 _lseeki64(int,__int64,int);
98 char* _mktemp(char*);
99 int _open(const char*,int,...);
100 int _open_osfhandle(intptr_t,int);
101 int _pipe(int*,unsigned int,int);
102 int _read(int,void*,unsigned int);
103 int _setmode(int,int);
104 int _sopen(const char*,int,int,...);
105 long _tell(int);
106 __int64 _telli64(int);
107 int _umask(int);
108 int _unlink(const char*);
109 int _write(int,const void*,unsigned int);
111 int remove(const char*);
112 int rename(const char*,const char*);
114 #ifndef _WIO_DEFINED
115 #define _WIO_DEFINED
116 int _waccess(const wchar_t*,int);
117 int _wchmod(const wchar_t*,int);
118 int _wcreat(const wchar_t*,int);
119 intptr_t _wfindfirst(const wchar_t*,struct _wfinddata_t*);
120 intptr_t _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
121 int _wfindnext(intptr_t,struct _wfinddata_t*);
122 int _wfindnexti64(intptr_t, struct _wfinddatai64_t*);
123 wchar_t*_wmktemp(wchar_t*);
124 int _wopen(const wchar_t*,int,...);
125 int _wrename(const wchar_t*,const wchar_t*);
126 int _wsopen(const wchar_t*,int,int,...);
127 int _wunlink(const wchar_t*);
128 #endif /* _WIO_DEFINED */
130 #ifdef __cplusplus
132 #endif
135 static inline int access(const char* path, int mode) { return _access(path, mode); }
136 static inline int chmod(const char* path, int mode) { return _chmod(path, mode); }
137 static inline int chsize(int fd, long size) { return _chsize(fd, size); }
138 static inline int close(int fd) { return _close(fd); }
139 static inline int creat(const char* path, int mode) { return _creat(path, mode); }
140 static inline int dup(int od) { return _dup(od); }
141 static inline int dup2(int od, int nd) { return _dup2(od, nd); }
142 static inline int eof(int fd) { return _eof(fd); }
143 static inline long filelength(int fd) { return _filelength(fd); }
144 static inline int isatty(int fd) { return _isatty(fd); }
145 static inline int locking(int fd, int mode, long size) { return _locking(fd, mode, size); }
146 static inline long lseek(int fd, long off, int where) { return _lseek(fd, off, where); }
147 static inline char* mktemp(char* pat) { return _mktemp(pat); }
148 static inline int read(int fd, void* buf, unsigned int size) { return _read(fd, buf, size); }
149 static inline int setmode(int fd, int mode) { return _setmode(fd, mode); }
150 static inline long tell(int fd) { return _tell(fd); }
151 #ifndef _UMASK_DEFINED
152 static inline int umask(int fd) { return _umask(fd); }
153 #define _UMASK_DEFINED
154 #endif
155 #ifndef _UNLINK_DEFINED
156 static inline int unlink(const char* path) { return _unlink(path); }
157 #define _UNLINK_DEFINED
158 #endif
159 static inline int write(int fd, const void* buf, unsigned int size) { return _write(fd, buf, size); }
161 #if defined(__GNUC__) && (__GNUC__ < 4)
162 extern int open(const char*,int,...) __attribute__((alias("_open")));
163 extern int sopen(const char*,int,int,...) __attribute__((alias("_sopen")));
164 #else
165 #define open _open
166 #define sopen _sopen
167 #endif /* __GNUC__ */
169 #include <poppack.h>
171 #endif /* __WINE_IO_H */