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) {...@@ -1548,6 +1548,7 @@ const have_sigwinch = switch (builtin.os.tag) {
1548 .visionos,1548 .visionos,
1549 .dragonfly,1549 .dragonfly,
1550 .freebsd,1550 .freebsd,
1551 .serenity,
1551 => true,1552 => true,
15521553
1553 else => false,1554 else => false,
lib/std/c.zig+7-7
...@@ -4131,7 +4131,7 @@ pub const msghdr_const = switch (native_os) {...@@ -4131,7 +4131,7 @@ pub const msghdr_const = switch (native_os) {
4131 .serenity => extern struct {4131 .serenity => extern struct {
4132 name: ?*const anyopaque,4132 name: ?*const anyopaque,
4133 namelen: socklen_t,4133 namelen: socklen_t,
4134 iov: [*]const iovec,4134 iov: [*]const iovec_const,
4135 iovlen: c_uint,4135 iovlen: c_uint,
4136 control: ?*const anyopaque,4136 control: ?*const anyopaque,
4137 controllen: socklen_t,4137 controllen: socklen_t,
...@@ -8614,7 +8614,7 @@ pub const O = switch (native_os) {...@@ -8614,7 +8614,7 @@ pub const O = switch (native_os) {
8614 },8614 },
8615 // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L28-L438615 // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L28-L43
8616 .serenity => packed struct(c_int) {8616 .serenity => packed struct(c_int) {
8617 ACCMODE: std.posix.ACCMODE = .RDONLY,8617 ACCMODE: std.posix.ACCMODE = .NONE,
8618 EXEC: bool = false,8618 EXEC: bool = false,
8619 CREAT: bool = false,8619 CREAT: bool = false,
8620 EXCL: bool = false,8620 EXCL: bool = false,
...@@ -8770,10 +8770,10 @@ pub const MAP = switch (native_os) {...@@ -8770,10 +8770,10 @@ pub const MAP = switch (native_os) {
8770 },8770 },
8771 // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L16-L268771 // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L16-L26
8772 .serenity => packed struct(c_int) {8772 .serenity => packed struct(c_int) {
8773 FILE: bool = false,8773 TYPE: enum(u4) {
8774 SHARED: bool = false,8774 SHARED = 0x01,
8775 PRIVATE: bool = false,8775 PRIVATE = 0x02,
8776 _3: u2 = 0,8776 },
8777 FIXED: bool = false,8777 FIXED: bool = false,
8778 ANONYMOUS: bool = false,8778 ANONYMOUS: bool = false,
8779 STACK: bool = false,8779 STACK: bool = false,
...@@ -8781,7 +8781,7 @@ pub const MAP = switch (native_os) {...@@ -8781,7 +8781,7 @@ pub const MAP = switch (native_os) {
8781 RANDOMIZED: bool = false,8781 RANDOMIZED: bool = false,
8782 PURGEABLE: bool = false,8782 PURGEABLE: bool = false,
8783 FIXED_NOREPLACE: bool = false,8783 FIXED_NOREPLACE: bool = false,
8784 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 12) = 0,8784 _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 11) = 0,
8785 },8785 },
8786 else => void,8786 else => void,
8787};8787};
lib/std/heap.zig+1-1
...@@ -146,7 +146,7 @@ const CAllocator = struct {...@@ -146,7 +146,7 @@ const CAllocator = struct {
146 else {};146 else {};
147147
148 pub const supports_posix_memalign = switch (builtin.os.tag) {148 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,
150 else => false,150 else => false,
151 };151 };
152152
lib/std/posix.zig+3-1
...@@ -204,6 +204,7 @@ pub const ACCMODE = switch (native_os) {...@@ -204,6 +204,7 @@ pub const ACCMODE = switch (native_os) {
204 // implements this suggestion.204 // implements this suggestion.
205 // https://github.com/SerenityOS/serenity/blob/4adc51fdf6af7d50679c48b39362e062f5a3b2cb/Kernel/API/POSIX/fcntl.h#L28-L30205 // https://github.com/SerenityOS/serenity/blob/4adc51fdf6af7d50679c48b39362e062f5a3b2cb/Kernel/API/POSIX/fcntl.h#L28-L30
206 .serenity => enum(u2) {206 .serenity => enum(u2) {
207 NONE = 0,
207 RDONLY = 1,208 RDONLY = 1,
208 WRONLY = 2,209 WRONLY = 2,
209 RDWR = 3,210 RDWR = 3,
...@@ -1128,8 +1129,9 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void {...@@ -1128,8 +1129,9 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void {
1128/// * Windows1129/// * Windows
1129/// On these systems, the read races with concurrent writes to the same file descriptor.1130/// On these systems, the read races with concurrent writes to the same file descriptor.
1130pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {1131pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {
1132 // NOTE: serenity does not have preadv but it *does* have pwritev.
1131 const have_pread_but_not_preadv = switch (native_os) {1133 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,
1133 else => false,1135 else => false,
1134 };1136 };
1135 if (have_pread_but_not_preadv) {1137 if (have_pread_but_not_preadv) {
lib/std/start.zig+1
...@@ -699,6 +699,7 @@ fn maybeIgnoreSigpipe() void {...@@ -699,6 +699,7 @@ fn maybeIgnoreSigpipe() void {
699 .visionos,699 .visionos,
700 .dragonfly,700 .dragonfly,
701 .freebsd,701 .freebsd,
702 .serenity,
702 => true,703 => true,
703704
704 else => false,705 else => false,