diff --git a/lib/std/c/haiku.zig b/lib/std/c/haiku.zig index 4706181bb95e..f4c928c79c48 100644 --- a/lib/std/c/haiku.zig +++ b/lib/std/c/haiku.zig @@ -110,21 +110,6 @@ pub const socklen_t = u32; // Modes and flags for dlopen() // include/dlfcn.h -pub const POLL = struct { - /// input available - pub const IN = 70; - /// output available - pub const OUT = 71; - /// input message available - pub const MSG = 72; - /// I/O error - pub const ERR = 73; - /// high priority input available - pub const PRI = 74; - /// device disconnected - pub const HUP = 75; -}; - pub const RTLD = struct { /// relocations are performed as needed pub const LAZY = 0; @@ -177,14 +162,6 @@ pub const msghdr = extern struct { pub const off_t = i64; pub const ino_t = u64; -pub const nfds_t = u32; - -pub const pollfd = extern struct { - fd: i32, - events: i16, - revents: i16, -}; - pub const Stat = extern struct { dev: i32, ino: u64, @@ -427,7 +404,39 @@ pub const W = struct { } }; -// posix/signal.h +// /system/develop/headers/posix/poll.h + +pub const nfds_t = usize; + +pub const pollfd = extern struct { + fd: i32, + events: i16, + revents: i16, +}; + +pub const POLL = struct { + /// any readable data available + pub const IN = 0x0001; + /// file descriptor is writeable + pub const OUT = 0x0002; + pub const RDNORM = IN; + pub const WRNORM = OUT; + /// priority readable data + pub const RDBAND = 0x0008; + /// priority data can be written + pub const WRBAND = 0x0010; + /// high priority readable data + pub const PRI = 0x0020; + + /// errors pending + pub const ERR = 0x0004; + /// disconnected + pub const HUP = 0x0080; + /// invalid file descriptor + pub const NVAL = 0x1000; +}; + +// /system/develop/headers/posix/signal.h pub const sigset_t = u64; pub const empty_sigset: sigset_t = 0; @@ -548,7 +557,7 @@ pub const ucontext_t = extern struct { mcontext: mcontext_t, }; -// arch/*/signal.h +// /system/develop/headers/posix/arch/*/signal.h pub const vregs = switch (builtin.cpu.arch) { .arm, .thumb => extern struct { diff --git a/lib/std/io.zig b/lib/std/io.zig index d0432d1ff910..9f0f444a8365 100644 --- a/lib/std/io.zig +++ b/lib/std/io.zig @@ -610,10 +610,7 @@ pub fn Poller(comptime StreamEnum: type) type { // allocate grows exponentially. const bump_amt = 512; - const err_mask = switch (builtin.target.os.tag) { - .haiku => posix.POLL.ERR | posix.POLL.HUP, - else => posix.POLL.ERR | posix.POLL.NVAL | posix.POLL.HUP, - }; + const err_mask = posix.POLL.ERR | posix.POLL.NVAL | posix.POLL.HUP; const events_len = try posix.poll(&self.poll_fds, if (nanoseconds) |ns| std.math.cast(i32, ns / std.time.ns_per_ms) orelse std.math.maxInt(i32) diff --git a/lib/std/zig/LibCInstallation.zig b/lib/std/zig/LibCInstallation.zig index 3305d9484ded..2a4e7d4b5b09 100644 --- a/lib/std/zig/LibCInstallation.zig +++ b/lib/std/zig/LibCInstallation.zig @@ -67,34 +67,34 @@ pub fn parse( } inline for (fields, 0..) |field, i| { if (!found_keys[i].found) { - log.err("missing field: {s}\n", .{field.name}); + log.err("missing field: {s}", .{field.name}); return error.ParseError; } } if (self.include_dir == null) { - log.err("include_dir may not be empty\n", .{}); + log.err("include_dir may not be empty", .{}); return error.ParseError; } if (self.sys_include_dir == null) { - log.err("sys_include_dir may not be empty\n", .{}); + log.err("sys_include_dir may not be empty", .{}); return error.ParseError; } const os_tag = target.os.tag; if (self.crt_dir == null and !target.isDarwin()) { - log.err("crt_dir may not be empty for {s}\n", .{@tagName(os_tag)}); + log.err("crt_dir may not be empty for {s}", .{@tagName(os_tag)}); return error.ParseError; } if (self.msvc_lib_dir == null and os_tag == .windows and target.abi == .msvc) { - log.err("msvc_lib_dir may not be empty for {s}-{s}\n", .{ + log.err("msvc_lib_dir may not be empty for {s}-{s}", .{ @tagName(os_tag), @tagName(target.abi), }); return error.ParseError; } if (self.kernel32_lib_dir == null and os_tag == .windows and target.abi == .msvc) { - log.err("kernel32_lib_dir may not be empty for {s}-{s}\n", .{ + log.err("kernel32_lib_dir may not be empty for {s}-{s}", .{ @tagName(os_tag), @tagName(target.abi), }); @@ -102,7 +102,7 @@ pub fn parse( } if (self.gcc_dir == null and os_tag == .haiku) { - log.err("gcc_dir may not be empty for {s}\n", .{@tagName(os_tag)}); + log.err("gcc_dir may not be empty for {s}", .{@tagName(os_tag)}); return error.ParseError; } diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index b7a5284be9f0..c9fe14a1c6f2 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -1017,7 +1017,7 @@ fn detectAbiAndDynamicLinker( error.FileTooBig, error.Unexpected, => |e| { - std.log.warn("Encountered error: {s}, falling back to default ABI and dynamic linker.\n", .{@errorName(e)}); + std.log.warn("Encountered error: {s}, falling back to default ABI and dynamic linker.", .{@errorName(e)}); return defaultAbiAndDynamicLinker(cpu, os, query); }, @@ -1065,7 +1065,7 @@ fn detectAbiAndDynamicLinker( error.NameTooLong, // Finally, we fall back on the standard path. => |e| { - std.log.warn("Encountered error: {s}, falling back to default ABI and dynamic linker.\n", .{@errorName(e)}); + std.log.warn("Encountered error: {s}, falling back to default ABI and dynamic linker.", .{@errorName(e)}); return defaultAbiAndDynamicLinker(cpu, os, query); }, };