mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::fs: Add non-blocking option passed to fd ctor's open(2) fwiw.
This commit is contained in:
parent
9994836db0
commit
3bed48011d
2 changed files with 4 additions and 0 deletions
|
@ -71,6 +71,9 @@ struct ircd::fs::fd::opts
|
|||
/// any implied O_CREAT from the open_mode ctor and in flags too.
|
||||
bool nocreate {false};
|
||||
|
||||
/// (O_NONBLOCK) Non-blocking behavior.
|
||||
bool blocking {true};
|
||||
|
||||
/// Construct options from an std::ios::open_mode bitmask.
|
||||
opts(const std::ios::openmode &);
|
||||
opts() = default;
|
||||
|
|
|
@ -1287,6 +1287,7 @@ ircd::fs::fd::fd(const string_view &path,
|
|||
flags |= opts.direct? O_DIRECT : 0UL;
|
||||
flags |= opts.cloexec? O_CLOEXEC : 0UL;
|
||||
flags &= opts.nocreate? ~O_CREAT : flags;
|
||||
flags |= !opts.blocking? O_NONBLOCK : 0UL;
|
||||
|
||||
const mode_t &mode(opts.mask);
|
||||
assert((flags & ~O_CREAT) || mode != 0);
|
||||
|
|
Loading…
Reference in a new issue