Debian Codegraph @

mingw-w64-headers/crt/io.h

raw
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6 #ifndef _IO_H_
7 #define _IO_H_
8
9 #include <crtdefs.h>
10 #include <string.h>
11
12 #if defined(__LIBMSVCRT__)
13 /* When building mingw-w64, this should be blank. */
14 #define _SECIMP
15 #else
16 #ifndef _SECIMP
17 #define _SECIMP __declspec(dllimport)
18 #endif /* _SECIMP */
19 #endif /* defined(__LIBMSVCRT__) */
20
21 #pragma pack(push,_CRT_PACKING)
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
28 #pragma push_macro("_getcwd")
29 #undef _getcwd
30 #endif
31 _CRTIMP char* __cdecl _getcwd (char*, int);
32 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
33 #pragma pop_macro("_getcwd")
34 #endif
35
36 #ifndef _FSIZE_T_DEFINED
37 typedef unsigned long _fsize_t;
38 #define _FSIZE_T_DEFINED
39 #endif
40
41 #ifndef _FINDDATA_T_DEFINED
42
43 struct _finddata32_t {
44 unsigned attrib;
45 __time32_t time_create;
46 __time32_t time_access;
47 __time32_t time_write;
48 _fsize_t size;
49 char name[260];
50 };
51
52 struct _finddata32i64_t {
53 unsigned attrib;
54 __time32_t time_create;
55 __time32_t time_access;
56 __time32_t time_write;
57 __MINGW_EXTENSION __int64 size;
58 char name[260];
59 };
60
61 struct _finddata64i32_t {
62 unsigned attrib;
63 __time64_t time_create;
64 __time64_t time_access;
65 __time64_t time_write;
66 _fsize_t size;
67 char name[260];
68 };
69
70 struct __finddata64_t {
71 unsigned attrib;
72 __time64_t time_create;
73 __time64_t time_access;
74 __time64_t time_write;
75 __MINGW_EXTENSION __int64 size;
76 char name[260];
77 };
78
79 /*
80 * To prevent ABI issues, the mingw-w64 runtime should not call these
81 * functions. Instead it should call the fixed-size variants.
82 */
83 #ifndef _CRTBLD
84 #ifdef _USE_32BIT_TIME_T
85 #define _finddata_t _finddata32_t
86 #define _finddatai64_t _finddata32i64_t
87
88 #define _findfirst _findfirst32
89 #define _findnext _findnext32
90 #define _findfirsti64 _findfirst32i64
91 #define _findnexti64 _findnext32i64
92 #else
93 #define _finddata_t _finddata64i32_t
94 #define _finddatai64_t __finddata64_t
95
96 #define _findfirst _findfirst64i32
97 #define _findnext _findnext64i32
98 #define _findfirsti64 _findfirst64
99 #define _findnexti64 _findnext64
100 #endif /* _USE_32BIT_TIME_T */
101 #endif /* _CRTBLD */
102
103 #define _FINDDATA_T_DEFINED
104 #endif /* _FINDDATA_T_DEFINED */
105
106 #ifndef _WFINDDATA_T_DEFINED
107
108 struct _wfinddata32_t {
109 unsigned attrib;
110 __time32_t time_create;
111 __time32_t time_access;
112 __time32_t time_write;
113 _fsize_t size;
114 wchar_t name[260];
115 };
116
117 struct _wfinddata32i64_t {
118 unsigned attrib;
119 __time32_t time_create;
120 __time32_t time_access;
121 __time32_t time_write;
122 __MINGW_EXTENSION __int64 size;
123 wchar_t name[260];
124 };
125
126 struct _wfinddata64i32_t {
127 unsigned attrib;
128 __time64_t time_create;
129 __time64_t time_access;
130 __time64_t time_write;
131 _fsize_t size;
132 wchar_t name[260];
133 };
134
135 struct _wfinddata64_t {
136 unsigned attrib;
137 __time64_t time_create;
138 __time64_t time_access;
139 __time64_t time_write;
140 __MINGW_EXTENSION __int64 size;
141 wchar_t name[260];
142 };
143
144 /*
145 * To prevent ABI issues, the mingw-w64 runtime should not call these
146 * functions. Instead it should call the fixed-size variants.
147 */
148 #ifndef _CRTBLD
149 #ifdef _USE_32BIT_TIME_T
150 #define _wfinddata_t _wfinddata32_t
151 #define _wfinddatai64_t _wfinddata32i64_t
152
153 #define _wfindfirst _wfindfirst32
154 #define _wfindnext _wfindnext32
155 #define _wfindfirsti64 _wfindfirst32i64
156 #define _wfindnexti64 _wfindnext32i64
157 #else
158 #define _wfinddata_t _wfinddata64i32_t
159 #define _wfinddatai64_t _wfinddata64_t
160
161 #define _wfindfirst _wfindfirst64i32
162 #define _wfindnext _wfindnext64i32
163 #define _wfindfirsti64 _wfindfirst64
164 #define _wfindnexti64 _wfindnext64
165 #endif /* _USE_32BIT_TIME_T */
166 #endif /* _CRTBLD */
167
168 #define _WFINDDATA_T_DEFINED
169 #endif /* _WFINDDATA_T_DEFINED */
170
171 #define _A_NORMAL 0x00
172 #define _A_RDONLY 0x01
173 #define _A_HIDDEN 0x02
174 #define _A_SYSTEM 0x04
175 #define _A_SUBDIR 0x10
176 #define _A_ARCH 0x20
177
178 #ifndef _SIZE_T_DEFINED
179 #define _SIZE_T_DEFINED
180 #undef size_t
181 #ifdef _WIN64
182 __MINGW_EXTENSION typedef unsigned __int64 size_t;
183 #else
184 typedef unsigned int size_t;
185 #endif /* _WIN64 */
186 #endif /* _SIZE_T_DEFINED */
187
188 #ifndef _SSIZE_T_DEFINED
189 #define _SSIZE_T_DEFINED
190 #undef ssize_t
191 #ifdef _WIN64
192 __MINGW_EXTENSION typedef __int64 ssize_t;
193 #else
194 typedef int ssize_t;
195 #endif /* _WIN64 */
196 #endif /* _SSIZE_T_DEFINED */
197
198 #include <_mingw_off_t.h>
199
200 /* Some defines for _access nAccessMode (MS doesn't define them, but
201 * it doesn't seem to hurt to add them). */
202 #define F_OK 0 /* Check for file existence */
203 #define X_OK 1 /* Check for execute permission. */
204 #define W_OK 2 /* Check for write permission */
205 #define R_OK 4 /* Check for read permission */
206
207 _CRTIMP int __cdecl _access(const char *_Filename,int _AccessMode);
208 _SECIMP errno_t __cdecl _access_s(const char *_Filename,int _AccessMode);
209 _CRTIMP int __cdecl _chmod(const char *_Filename,int _Mode);
210 _CRTIMP int __cdecl _chsize(int _FileHandle,long _Size) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
211 _SECIMP errno_t __cdecl _chsize_s (int _FileHandle,__int64 _Size);
212 _CRTIMP int __cdecl _close(int _FileHandle);
213 _CRTIMP int __cdecl _commit(int _FileHandle);
214 _CRTIMP int __cdecl _creat(const char *_Filename,int _PermissionMode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
215 _CRTIMP int __cdecl _dup(int _FileHandle);
216 _CRTIMP int __cdecl _dup2(int _FileHandleSrc,int _FileHandleDst);
217 _CRTIMP int __cdecl _eof(int _FileHandle);
218 _CRTIMP long __cdecl _filelength(int _FileHandle);
219 _CRTIMP intptr_t __cdecl _findfirst32(const char *_Filename,struct _finddata32_t *_FindData);
220 _CRTIMP int __cdecl _findnext32(intptr_t _FindHandle,struct _finddata32_t *_FindData);
221 _CRTIMP int __cdecl _findclose(intptr_t _FindHandle);
222 _CRTIMP int __cdecl _isatty(int _FileHandle);
223 _CRTIMP int __cdecl _locking(int _FileHandle,int _LockMode,long _NumOfBytes);
224 _CRTIMP long __cdecl _lseek(int _FileHandle,long _Offset,int _Origin);
225 _off64_t lseek64(int fd,_off64_t offset, int whence);
226 _CRTIMP char *__cdecl _mktemp(char *_TemplateName) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
227 _SECIMP errno_t __cdecl _mktemp_s (char *_TemplateName,size_t _Size);
228 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
229 _CRTIMP int __cdecl _pipe(int *_PtHandles,unsigned int _PipeSize,int _TextMode);
230 #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */
231 _CRTIMP int __cdecl _read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount);
232
233 #ifndef _CRT_DIRECTORY_DEFINED
234 #define _CRT_DIRECTORY_DEFINED
235 int __cdecl remove(const char *_Filename);
236 int __cdecl rename(const char *_OldFilename,const char *_NewFilename);
237 _CRTIMP int __cdecl _unlink(const char *_Filename);
238 #ifndef NO_OLDNAMES
239 int __cdecl unlink(const char *_Filename) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
240 #endif
241 #endif
242
243 _CRTIMP int __cdecl _setmode(int _FileHandle,int _Mode);
244 _CRTIMP long __cdecl _tell(int _FileHandle);
245 _CRTIMP int __cdecl _umask(int _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
246 _SECIMP errno_t __cdecl _umask_s (int _NewMode,int *_OldMode);
247 _CRTIMP int __cdecl _write(int _FileHandle,const void *_Buf,unsigned int _MaxCharCount);
248
249 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _filelengthi64(int _FileHandle);
250 _CRTIMP intptr_t __cdecl _findfirst32i64(const char *_Filename,struct _finddata32i64_t *_FindData);
251 _CRTIMP intptr_t __cdecl _findfirst64(const char *_Filename,struct __finddata64_t *_FindData);
252 _CRTIMP intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData);
253 _CRTIMP int __cdecl _findnext32i64(intptr_t _FindHandle,struct _finddata32i64_t *_FindData);
254 _CRTIMP int __cdecl _findnext64(intptr_t _FindHandle,struct __finddata64_t *_FindData);
255 _CRTIMP int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData);
256 __MINGW_EXTENSION __int64 __cdecl _lseeki64(int _FileHandle,__int64 _Offset,int _Origin);
257 __MINGW_EXTENSION __int64 __cdecl _telli64(int _FileHandle);
258
259 #ifndef NO_OLDNAMES
260 #ifndef _UWIN
261 int __cdecl chdir (const char *) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
262 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
263 #pragma push_macro("getcwd")
264 #undef getcwd
265 #endif
266 char *__cdecl getcwd (char *, int) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
267 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
268 #pragma pop_macro("getcwd")
269 #endif
270 int __cdecl mkdir (const char *) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
271 char *__cdecl mktemp(char *) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
272 int __cdecl rmdir (const char*) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
273 int __cdecl chmod (const char *, int) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
274 #endif /* _UWIN */
275 #endif /* Not NO_OLDNAMES */
276
277 _SECIMP errno_t __cdecl _sopen_s(int *_FileHandle,const char *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode);
278
279 _CRTIMP int __cdecl _open(const char *_Filename,int _OpenFlag,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
280 _CRTIMP int __cdecl _sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
281
282 #ifndef _WIO_DEFINED
283 #define _WIO_DEFINED
284 _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode);
285 _SECIMP errno_t __cdecl _waccess_s (const wchar_t *_Filename,int _AccessMode);
286 _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode);
287 _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
288 _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData);
289 _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData);
290 _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename);
291 _CRTIMP int __cdecl _wrename(const wchar_t *_OldFilename,const wchar_t *_NewFilename);
292 _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
293 _SECIMP errno_t __cdecl _wmktemp_s (wchar_t *_TemplateName, size_t _SizeInWords);
294
295 _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData);
296 intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData);
297 _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData);
298 _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData);
299 int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData);
300 _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData);
301
302 _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag);
303
304 _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
305 _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
306
307 #endif
308
309 int __cdecl __lock_fhandle(int _Filehandle);
310 void __cdecl _unlock_fhandle(int _Filehandle);
311 _CRTIMP intptr_t __cdecl _get_osfhandle(int _FileHandle);
312 _CRTIMP int __cdecl _open_osfhandle(intptr_t _OSFileHandle,int _Flags);
313
314 #ifndef NO_OLDNAMES
315 int __cdecl access(const char *_Filename,int _AccessMode) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
316 int __cdecl chmod(const char *_Filename,int _AccessMode) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
317 int __cdecl chsize(int _FileHandle,long _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
318 int __cdecl close(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
319 int __cdecl creat(const char *_Filename,int _PermissionMode) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
320 int __cdecl creat64(const char *_Filename,int _PermissionMode);
321 int __cdecl dup(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
322 int __cdecl dup2(int _FileHandleSrc,int _FileHandleDst) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
323 int __cdecl eof(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
324 long __cdecl filelength(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
325 int __cdecl isatty(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
326 int __cdecl locking(int _FileHandle,int _LockMode,long _NumOfBytes) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
327 off_t __cdecl lseek(int _FileHandle,off_t _Offset,int _Origin)
328 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
329 __MINGW_ASM_CALL(lseek64)
330 #endif
331 __MINGW_ATTRIB_DEPRECATED_MSVC2005;
332 char *__cdecl mktemp(char *_TemplateName) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
333 int __cdecl open(const char *_Filename,int _OpenFlag,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
334 int __cdecl open64(const char *_Filename,int _OpenFlag,...);
335 int __cdecl read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
336 int __cdecl setmode(int _FileHandle,int _Mode) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
337 int __cdecl sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
338 long __cdecl tell(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
339 int __cdecl umask(int _Mode) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
340 int __cdecl write(int _Filehandle,const void *_Buf,unsigned int _MaxCharCount) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
341 #endif
342
343 #ifdef _POSIX
344
345 /* Misc stuff */
346 char *getlogin(void);
347 #ifdef __USE_MINGW_ALARM
348 unsigned int alarm(unsigned int seconds);
349 #endif
350
351 #endif
352
353 #ifdef __USE_MINGW_ACCESS
354 /* Old versions of MSVCRT access() just ignored X_OK, while the version
355 shipped with Vista, returns an error code. This will restore the
356 old behaviour */
357 int __cdecl __mingw_access (const char *__fname, int __mode);
358
359 #define access(__f,__m) __mingw_access (__f, __m)
360 #endif
361
362 #if __MINGW_FORTIFY_LEVEL > 0
363
364 _CRTIMP int __cdecl __mingw_call__read(int, void *, unsigned int) __MINGW_ASM_CRT_CALL(_read);
365
366 __mingw_bos_extern_ovr
367 int _read(int __fh, void * __dst, unsigned int __n)
368 {
369 __mingw_bos_ptr_chk_warn(__dst, __n, 0);
370 return __mingw_call__read(__fh, __dst, __n);
371 }
372
373 #ifndef NO_OLDNAMES
374 __mingw_bos_extern_ovr
375 int read(int __fh, void * __dst, unsigned int __n)
376 {
377 return _read(__fh, __dst, __n);
378 }
379 #endif
380
381 #if __MINGW_FORTIFY_VA_ARG
382
383 #define _O_CREAT 0x0100
384
385 _CRTIMP int __cdecl __mingw_call__open(const char *, int, ...) __MINGW_ASM_CRT_CALL(_open);
386 _CRTIMP int __cdecl __mingw_call__open_warn_toomany(const char *, int, ...) __MINGW_ASM_CRT_CALL(_open)
387 __attribute__((__warning__("_open(): too many arguments")));
388 _CRTIMP int __cdecl __mingw_call__open_warn_missing(const char *, int, ...) __MINGW_ASM_CRT_CALL(_open)
389 __attribute__((__warning__("_open(..._O_CREAT...): missing argument")));
390
391 __mingw_bos_extern_ovr
392 int _open(const char * __filename, int __flags, ...)
393 {
394 if (__builtin_va_arg_pack_len() > 1)
395 return __mingw_call__open_warn_toomany(__filename, __flags, __builtin_va_arg_pack());
396 if (__builtin_va_arg_pack_len() < 1 && __builtin_constant_p(__flags & _O_CREAT) && (__flags & _O_CREAT))
397 return __mingw_call__open_warn_missing(__filename, __flags, 0);
398 if (__builtin_va_arg_pack_len() < 1)
399 return __mingw_call__open(__filename, __flags, 0);
400 return __mingw_call__open(__filename, __flags, __builtin_va_arg_pack());
401 }
402
403 _CRTIMP int __cdecl __mingw_call__sopen(const char *, int, int, ...) __MINGW_ASM_CRT_CALL(_sopen);
404 _CRTIMP int __cdecl __mingw_call__sopen_warn_toomany(const char *, int, int, ...) __MINGW_ASM_CRT_CALL(_sopen)
405 __attribute__((__warning__("_sopen(): too many arguments")));
406 _CRTIMP int __cdecl __mingw_call__sopen_warn_missing(const char *, int, int, ...) __MINGW_ASM_CRT_CALL(_sopen)
407 __attribute__((__warning__("_sopen(..._O_CREAT...): missing argument")));
408
409 __mingw_bos_extern_ovr
410 int _sopen(const char * __filename, int __flags, int __share, ...)
411 {
412 if (__builtin_va_arg_pack_len() > 1)
413 return __mingw_call__sopen_warn_toomany(__filename, __flags, __share, __builtin_va_arg_pack());
414 if (__builtin_va_arg_pack_len() < 1 && __builtin_constant_p(__flags & _O_CREAT) && (__flags & _O_CREAT))
415 return __mingw_call__sopen_warn_missing(__filename, __flags, __share, 0);
416 if (__builtin_va_arg_pack_len() < 1)
417 return __mingw_call__sopen(__filename, __flags, __share, 0);
418 return __mingw_call__sopen(__filename, __flags, __share, __builtin_va_arg_pack());
419 }
420
421 _CRTIMP int __cdecl __mingw_call__wopen(const wchar_t *, int, ...) __MINGW_ASM_CRT_CALL(_wopen);
422 _CRTIMP int __cdecl __mingw_call__wopen_warn_toomany(const wchar_t *, int, ...) __MINGW_ASM_CRT_CALL(_wopen)
423 __attribute__((__warning__("_wopen(): too many arguments")));
424 _CRTIMP int __cdecl __mingw_call__wopen_warn_missing(const wchar_t *, int, ...) __MINGW_ASM_CRT_CALL(_wopen)
425 __attribute__((__warning__("_wopen(..._O_CREAT...): missing argument")));
426
427 __mingw_bos_extern_ovr
428 int _wopen(const wchar_t * __filename, int __flags, ...)
429 {
430 if (__builtin_va_arg_pack_len() > 1)
431 return __mingw_call__wopen_warn_toomany(__filename, __flags, __builtin_va_arg_pack());
432 if (__builtin_va_arg_pack_len() < 1 && __builtin_constant_p(__flags & _O_CREAT) && (__flags & _O_CREAT))
433 return __mingw_call__wopen_warn_missing(__filename, __flags, 0);
434 if (__builtin_va_arg_pack_len() < 1)
435 return __mingw_call__wopen(__filename, __flags, 0);
436 return __mingw_call__wopen(__filename, __flags, __builtin_va_arg_pack());
437 }
438
439 _CRTIMP int __cdecl __mingw_call__wsopen(const wchar_t *, int, int, ...) __MINGW_ASM_CRT_CALL(_wsopen);
440 _CRTIMP int __cdecl __mingw_call__wsopen_warn_toomany(const wchar_t *, int, int, ...) __MINGW_ASM_CRT_CALL(_wsopen)
441 __attribute__((__warning__("_wsopen(): too many arguments")));
442 _CRTIMP int __cdecl __mingw_call__wsopen_warn_missing(const wchar_t *, int, int, ...) __MINGW_ASM_CRT_CALL(_wsopen)
443 __attribute__((__warning__("_wsopen(..._O_CREAT...): missing argument")));
444
445 __mingw_bos_extern_ovr
446 int _wsopen(const wchar_t * __filename, int __flags, int __share, ...)
447 {
448 if (__builtin_va_arg_pack_len() > 1)
449 return __mingw_call__wsopen_warn_toomany(__filename, __flags, __share, __builtin_va_arg_pack());
450 if (__builtin_va_arg_pack_len() < 1 && __builtin_constant_p(__flags & _O_CREAT) && (__flags & _O_CREAT))
451 return __mingw_call__wsopen_warn_missing(__filename, __flags, __share, 0);
452 if (__builtin_va_arg_pack_len() < 1)
453 return __mingw_call__wsopen(__filename, __flags, __share, 0);
454 return __mingw_call__wsopen(__filename, __flags, __share, __builtin_va_arg_pack());
455 }
456
457 #ifndef NO_OLDNAMES
458 __mingw_bos_extern_ovr
459 int open(const char * __filename, int __flags, ...)
460 {
461 return _open(__filename, __flags, __builtin_va_arg_pack());
462 }
463
464 __mingw_bos_extern_ovr
465 int sopen(const char * __filename, int __flags, int __share, ...)
466 {
467 return _sopen(__filename, __flags, __share, __builtin_va_arg_pack());
468 }
469 #endif
470
471 #endif /* __MINGW_FORTIFY_VA_ARG */
472 #endif /* __MINGW_FORTIFY_LEVEL > 0 */
473
474 #ifdef __cplusplus
475 }
476 #endif
477
478
479 #pragma pack(pop)
480
481 #endif /* End _IO_H_ */
482