Open the file.
- Parameters
-
[in] | flags | the flags used to open the file |
[in] | umask | the file mode (ignored if the file exists) |
- Returns
- *this
- Exceptions
-
- Note
- If the file is already open, it is re-opened with the new flags
Definition at line 162 of file filebuf.cpp.
References csdbg::streambuf::close(), csdbg::util::is_regular(), csdbg::util::is_writable(), csdbg::streambuf::m_handle, m_path, open(), and unlikely.
174 "failed to open file '%s' (errno %d - %s)",
186 "failed to stat path '%s' (errno %d - %s)",
193 throw exception(
"'%s' is not a regular file",
m_path);
196 throw exception(
"file '%s' is not writable",
m_path);
static bool is_writable(const fileinfo_t &)
Check if the process has write access to a file.
struct stat fileinfo_t
File metadata.
i32 m_handle
Stream handle (descriptor)
virtual filebuf & open()
Open the file for output.
int i32
32-bit signed integer
static bool is_regular(const fileinfo_t &)
Check if a file is a regular one.
i8 * m_path
Output file path.
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
virtual streambuf & close()
Close the stream.