Skip to content

Commit 6810ffa

Browse files
authored
Merge pull request ziglang#24031 from ypsvlq/master
Haiku fixes
2 parents 4d79806 + 7f73187 commit 6810ffa

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

lib/compiler/build_runner.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ pub fn main() !void {
415415
else => return err,
416416
};
417417

418-
var w = if (watch) try Watch.init() else undefined;
418+
var w: Watch = if (watch and Watch.have_impl) try Watch.init() else undefined;
419419

420420
try run.thread_pool.init(thread_pool_options);
421421
defer run.thread_pool.deinit();
@@ -435,6 +435,9 @@ pub fn main() !void {
435435
else => return err,
436436
};
437437
if (fuzz) {
438+
if (builtin.single_threaded) {
439+
fatal("--fuzz not yet implemented for single-threaded builds", .{});
440+
}
438441
switch (builtin.os.tag) {
439442
// Current implementation depends on two things that need to be ported to Windows:
440443
// * Memory-mapping to share data between the fuzzer and build runner.

lib/std/Build/Watch.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ const Os = switch (builtin.os.tag) {
600600
};
601601
}
602602
},
603-
.dragonfly, .freebsd, .netbsd, .openbsd, .ios, .macos, .tvos, .visionos, .watchos, .haiku => struct {
603+
.dragonfly, .freebsd, .netbsd, .openbsd, .ios, .macos, .tvos, .visionos, .watchos => struct {
604604
const posix = std.posix;
605605

606606
kq_fd: i32,

lib/std/c.zig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5703,6 +5703,9 @@ pub const SOCK = switch (native_os) {
57035703
pub const RAW = 3;
57045704
pub const SEQPACKET = 5;
57055705
pub const MISC = 255;
5706+
5707+
pub const NONBLOCK = 0x40000;
5708+
pub const CLOEXEC = 0x80000;
57065709
},
57075710
.openbsd => struct {
57085711
pub const STREAM = 1;
@@ -10824,8 +10827,8 @@ pub const LC = enum(c_int) {
1082410827

1082510828
pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) ?[*:0]const u8;
1082610829

10827-
pub const getcontext = if (builtin.target.abi.isAndroid() or builtin.target.os.tag == .openbsd)
10828-
{} // android bionic and openbsd libc does not implement getcontext
10830+
pub const getcontext = if (builtin.target.abi.isAndroid() or builtin.target.os.tag == .openbsd or builtin.target.os.tag == .haiku)
10831+
{} // libc does not implement getcontext
1082910832
else if (native_os == .linux and builtin.target.abi.isMusl())
1083010833
linux.getcontext
1083110834
else

lib/std/c/haiku.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ pub extern "root" fn get_system_info(system_info: *system_info) usize;
2323
pub extern "root" fn _get_team_info(team: i32, team_info: *team_info, size: usize) i32;
2424
pub extern "root" fn _get_next_area_info(team: i32, cookie: *i64, area_info: *area_info, size: usize) i32;
2525
pub extern "root" fn _get_next_image_info(team: i32, cookie: *i32, image_info: *image_info, size: usize) i32;
26+
pub extern "root" fn _kern_get_current_team() team_id;
27+
pub extern "root" fn _kern_open_dir(fd: fd_t, path: [*:0]const u8) fd_t;
28+
pub extern "root" fn _kern_read_dir(fd: fd_t, buffer: [*]u8, bufferSize: usize, maxCount: u32) isize;
29+
pub extern "root" fn _kern_rewind_dir(fd: fd_t) status_t;
30+
pub extern "root" fn _kern_read_stat(fd: fd_t, path: [*:0]const u8, traverseLink: bool, stat: *std.c.Stat, statSize: usize) status_t;
2631

2732
pub const area_info = extern struct {
2833
area: u32,

lib/std/crypto/Certificate/Bundle.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void {
6464
.netbsd => return rescanWithPath(cb, gpa, "/etc/openssl/certs/ca-certificates.crt"),
6565
.dragonfly => return rescanWithPath(cb, gpa, "/usr/local/etc/ssl/cert.pem"),
6666
.solaris, .illumos => return rescanWithPath(cb, gpa, "/etc/ssl/cacert.pem"),
67+
.haiku => return rescanWithPath(cb, gpa, "/boot/system/data/ssl/CARootCertificates.pem"),
6768
// https://github.com/SerenityOS/serenity/blob/222acc9d389bc6b490d4c39539761b043a4bfcb0/Ports/ca-certificates/package.sh#L19
6869
.serenity => return rescanWithPath(cb, gpa, "/etc/ssl/certs/ca-certificates.crt"),
6970
.windows => return rescanWindows(cb, gpa),

lib/std/fs/Dir.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub const Entry = struct {
1313

1414
const IteratorError = error{
1515
AccessDenied,
16+
PermissionDenied,
1617
SystemResources,
1718
/// WASI-only. The path of an entry could not be encoded as valid UTF-8.
1819
/// WASI is unable to handle paths that cannot be encoded as well-formed UTF-8.
@@ -287,7 +288,7 @@ pub const Iterator = switch (native_os) {
287288
name,
288289
false,
289290
&stat_info,
290-
0,
291+
@sizeOf(posix.Stat),
291292
)))) {
292293
.SUCCESS => {},
293294
.INVAL => unreachable,

0 commit comments

Comments
 (0)