aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/open.ccm
diff options
context:
space:
mode:
Diffstat (limited to 'nihil.posix/open.ccm')
-rw-r--r--nihil.posix/open.ccm24
1 files changed, 24 insertions, 0 deletions
diff --git a/nihil.posix/open.ccm b/nihil.posix/open.ccm
new file mode 100644
index 0000000..eaedacd
--- /dev/null
+++ b/nihil.posix/open.ccm
@@ -0,0 +1,24 @@
+/*
+ * This source code is released into the public domain.
+ */
+
+module;
+
+#include <expected>
+#include <filesystem>
+
+export module nihil.posix:open;
+
+import nihil.error;
+import :fd;
+
+export namespace nihil {
+
+/*
+ * Open the given file and return an fd for it.
+ */
+[[nodiscard]] auto open(std::filesystem::path const &filename,
+ int flags, int mode = 0777)
+ -> std::expected<fd, error>;
+
+} // namespace nihil