Need some clarification here. Why do we need a different mutate-directory
flag, when we already have write
flag?
flags descriptor-flags {
/// Read mode: Data can be read.
read,
/// Write mode: Data can be written to.
write,
// ...
/// Mutating directories mode: Directory contents may be mutated.
///
/// When this flag is unset on a descriptor, operations using the
/// descriptor which would create, rename, delete, modify the data or
/// metadata of filesystem objects, or obtain another handle which
/// would permit any of those, shall fail with `error-code::read-only` if
/// they would otherwise succeed.
///
/// This may only be set on directories.
mutate-directory,
}
It fits better with POSIX compatibility. In POSIX, write access for a file is obtained by opening the file with O_WRONLY
or O_RDWR
, but opening a directory with O_WRONLY
or O_RDWR
fails, with EISDIR
.
Right. That makes sense. So would specifying write
fail on directories? What about read
?
Yes, opening a directory with write
fails. But it succeeds with just read
.
Last updated: Nov 22 2024 at 16:03 UTC