Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
filesystem.h
Go to the documentation of this file.
1/* Copyright (C) 2026 Wildfire Games.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining
4 * a copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to
8 * permit persons to whom the Software is furnished to do so, subject to
9 * the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23/*
24 * wchar_t versions of POSIX filesystem functions
25 */
26
27#ifndef INCLUDED_SYSDEP_FILESYSTEM
28#define INCLUDED_SYSDEP_FILESYSTEM
29
30#include "lib/os_path.h"
31#include "lib/posix/posix_filesystem.h" // mode_t
32
33
34//
35// fcntl.h
36//
37
38// transfer directly to/from user's buffer.
39// treated as a request to enable aio.
40#ifndef O_DIRECT // i.e. Windows or OS X
41#define O_DIRECT 0x10000000 // (value does not conflict with any current Win32 _O_* flags.)
42#endif
43
44// Win32 _wsopen_s does not open files in a manner compatible with waio.
45// if its aio_read/aio_write are to be used, waio_open must (also) be called.
46// calling both is possible but wasteful and unsafe, since it prevents
47// file sharing restrictions, which are the only way to prevent
48// exposing previous data as a side effect of waio_Preallocate.
49// applications shouldn't mix aio and synchronous I/O anyway, so we
50// want wopen to call either waio_open or _wsopen_s.
51// since waio requires callers to respect the FILE_FLAG_NO_BUFFERING
52// restrictions (sector alignment), and IRIX/BSD/Linux O_DIRECT imposes
53// similar semantics, we treat that flag as a request to enable aio.
54extern int wopen(const OsPath& pathname, int oflag);
55extern int wopen(const OsPath& pathname, int oflag, mode_t mode);
56extern int wclose(int fd);
57
58#endif // #ifndef INCLUDED_SYSDEP_FILESYSTEM
Definition: path.h:84
int wopen(const OsPath &pathname, int oflag)
Definition: ufilesystem.cpp:45
int wclose(int fd)
Definition: ufilesystem.cpp:56