authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-31 09:56:26-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-07-31 09:56:26-07:00
log982c387753c33a9eb42349c109fc4a6ed0675165
treed3314abedac7c83e2f2c0e932dba78b9284e1270
parent627a292a1139c96f5de80084ab5ce8b852db5132
parentce776d32455f5ac43f91cc8904765836c00605cf
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #24633 from linusg/more-serenity-fixes

std: A few more fixes for serenity

5 files changed, 13 insertions(+), 9 deletions(-)

lib/std/Progress.zig+1
......@@ -1548,6 +1548,7 @@ const have_sigwinch = switch (builtin.os.tag) {
15481548 .visionos,
15491549 .dragonfly,
15501550 .freebsd,
1551 .serenity,
15511552 => true,
15521553
15531554 else => false,
lib/std/c.zig+7-7
......@@ -4131,7 +4131,7 @@ pub const msghdr_const = switch (native_os) {
41314131 .serenity => extern struct {
41324132 name: ?*const anyopaque,
41334133 namelen: socklen_t,
4134 iov: [*]const iovec,
4134 iov: [*]const iovec_const,
41354135 iovlen: c_uint,
41364136 control: ?*const anyopaque,
41374137 controllen: socklen_t,
......@@ -8614,7 +8614,7 @@ pub const O = switch (native_os) {
86148614 },
86158615 // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L28-L43
86168616 .serenity => packed struct(c_int) {
8617 ACCMODE: std.posix.ACCMODE = .RDONLY,
8617 ACCMODE: std.posix.ACCMODE = .NONE,
86188618 EXEC: bool = false,
86198619 CREAT: bool = false,
86208620 EXCL: bool = false,
......@@ -8770,10 +8770,10 @@ pub const MAP = switch (native_os) {
87708770 },
87718771 // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L16-L26
87728772 .serenity => packed struct(c_int) {
8773 FILE: bool = false,
8774 SHARED: bool = false,
8775 PRIVATE: bool = false,
8776 _3: u2 = 0,
8773 TYPE: enum(u4) {
8774 SHARED = 0x01,
8775 PRIVATE = 0x02,
8776 },
87778777 FIXED: bool = false,
87788778 ANONYMOUS: bool = false,
87798779 STACK: bool = false,
......@@ -8781,7 +8781,7 @@ pub const MAP = switch (native_os) {
87818781 RANDOMIZED: bool = false,
87828782 PURGEABLE: bool = false,
87838783 FIXED_NOREPLACE: bool = false,
8784 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 12) = 0,
8784 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 11) = 0,
87858785 },
87868786 else => void,
87878787};
lib/std/heap.zig+1-1
......@@ -146,7 +146,7 @@ const CAllocator = struct {
146146 else {};
147147
148148 pub const supports_posix_memalign = switch (builtin.os.tag) {
149 .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .linux, .macos, .ios, .tvos, .watchos, .visionos => true,
149 .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .linux, .macos, .ios, .tvos, .watchos, .visionos, .serenity => true,
150150 else => false,
151151 };
152152
lib/std/posix.zig+3-1
......@@ -204,6 +204,7 @@ pub const ACCMODE = switch (native_os) {
204204 // implements this suggestion.
205205 // https://github.com/SerenityOS/serenity/blob/4adc51fdf6af7d50679c48b39362e062f5a3b2cb/Kernel/API/POSIX/fcntl.h#L28-L30
206206 .serenity => enum(u2) {
207 NONE = 0,
207208 RDONLY = 1,
208209 WRONLY = 2,
209210 RDWR = 3,
......@@ -1128,8 +1129,9 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void {
11281129/// * Windows
11291130/// On these systems, the read races with concurrent writes to the same file descriptor.
11301131pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {
1132 // NOTE: serenity does not have preadv but it *does* have pwritev.
11311133 const have_pread_but_not_preadv = switch (native_os) {
1132 .windows, .macos, .ios, .watchos, .tvos, .visionos, .haiku => true,
1134 .windows, .macos, .ios, .watchos, .tvos, .visionos, .haiku, .serenity => true,
11331135 else => false,
11341136 };
11351137 if (have_pread_but_not_preadv) {
lib/std/start.zig+1
......@@ -699,6 +699,7 @@ fn maybeIgnoreSigpipe() void {
699699 .visionos,
700700 .dragonfly,
701701 .freebsd,
702 .serenity,
702703 => true,
703704
704705 else => false,