commit 0fc923bac767613bd29e714857bd04cd53094ed5
parent 5061dd5148394dc618d8066bbad97d70069f1bc7
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 24 Feb 2021 15:42:13 -0500
os::dirfdopen: accept resolve flags
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha
@@ -53,9 +53,15 @@ fn static_dirfdopen(fd: int, filesystem: *os_filesystem) *fs::fs = {
return &filesystem.fs;
};
-export fn dirfdopen(fd: int) *fs::fs = {
+// Opens a file descriptor as an [fs::fs]. This file descriptor must be a
+// directory file.
+export fn dirfdopen(fd: int, resolve: resolve...) *fs::fs = {
let fs = alloc(os_filesystem { ... });
- return static_dirfdopen(fd, fs);
+ let fsfs = static_dirfdopen(fd, fs);
+ for (let i = 0z; i < len(resolve); i += 1) {
+ fs.resolve |= resolve[i];
+ };
+ return fsfs;
};
// Clones a dirfd filesystem, optionally adding additional [resolve]