summaryrefslogtreecommitdiff
path: root/src/shared/include
diff options
context:
space:
mode:
authordzwdz2022-10-02 19:25:17 +0200
committerdzwdz2022-10-02 19:25:17 +0200
commit710e9b2b5c16f74f66420c66d12455ad518d42c7 (patch)
tree82b88cc07ef3f122512354d649af68584bd4da4d /src/shared/include
parent503d9ff758f8b83295830bdfc8c2ea56837d25e5 (diff)
syscall/open: add the full suite of READ/WRITE flags
Diffstat (limited to 'src/shared/include')
-rw-r--r--src/shared/include/camellia/flags.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/shared/include/camellia/flags.h b/src/shared/include/camellia/flags.h
index 0eaa02e..b7cc42d 100644
--- a/src/shared/include/camellia/flags.h
+++ b/src/shared/include/camellia/flags.h
@@ -10,7 +10,20 @@
#define WRITE_TRUNCATE 1
-#define OPEN_CREATE 1
-#define OPEN_RO 2
-
#define FSR_DELEGATE 1
+
+
+#define OPEN_READ 1
+#define OPEN_WRITE 2
+#define OPEN_RW 3
+/* not setting OPEN_READ nor OPEN_WRITE works as if OPEN_READ was set, but it also checks the execute bit.
+ * same as in plan9. */
+#define OPEN_EXEC 0
+
+#define OPEN_READABLE(flags) ((flags & 3) != OPEN_WRITE)
+#define OPEN_WRITEABLE(flags) (flags & OPEN_WRITE)
+
+/* Requires OPEN_WRITE to be set, enforced by the kernel.
+ * The idea is that if all flags which allow modifying the filesystem state require
+ * OPEN_WRITE to be set, filesystem handlers could just check for the OPEN_WRITE flag. */
+#define OPEN_CREATE 4