Commit 813a0f125e

Linus Groh <mail@linusgroh.de>
2025-07-31 00:27:32
std.posix: Default ACCMODE to NONE for serenity
Unlike all other platforms where RDONLY is 0 it does not work as a default for the O flags on serenity - various syscalls other than 'open', e.g. 'pipe', return EINVAL if unexpected bits are set in the flags.
1 parent f5e9384
Changed files (2)
lib/std/c.zig
@@ -8604,7 +8604,7 @@ pub const O = switch (native_os) {
     },
     // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L28-L43
     .serenity => packed struct(c_int) {
-        ACCMODE: std.posix.ACCMODE = .RDONLY,
+        ACCMODE: std.posix.ACCMODE = .NONE,
         EXEC: bool = false,
         CREAT: bool = false,
         EXCL: bool = false,
lib/std/posix.zig
@@ -204,6 +204,7 @@ pub const ACCMODE = switch (native_os) {
     // implements this suggestion.
     // https://github.com/SerenityOS/serenity/blob/4adc51fdf6af7d50679c48b39362e062f5a3b2cb/Kernel/API/POSIX/fcntl.h#L28-L30
     .serenity => enum(u2) {
+        NONE = 0,
         RDONLY = 1,
         WRONLY = 2,
         RDWR = 3,