Skip to content

Commit 982c387

Browse files
authored
Merge pull request #24633 from linusg/more-serenity-fixes
std: A few more fixes for serenity
2 parents 627a292 + ce776d3 commit 982c387

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

lib/std/Progress.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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,18 +8770,18 @@ 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,
87808780
NORESERVE: bool = false,
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.
11301131
pub 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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ fn maybeIgnoreSigpipe() void {
699699
.visionos,
700700
.dragonfly,
701701
.freebsd,
702+
.serenity,
702703
=> true,
703704

704705
else => false,

0 commit comments

Comments
 (0)