authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-12-12 22:28:15-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-12-12 22:28:15-05:00
logd770333827549e5dcbb727c7f434eaac9dd433d2
tree31cdb225e15570b0cda3a1f25cc2ee696a9d849d
parentb883bc873df7f1a8fa3a13800402e1ec8da74328
signaturelock-open Commit is signed but in an unrecognized format.

freebsd: fix os_self_exe_path function and update std lib


2 files changed, 5 insertions(+), 4 deletions(-)

src/os.cpp+1-1
...@@ -1456,7 +1456,7 @@ Error os_self_exe_path(Buf *out_path) {...@@ -1456,7 +1456,7 @@ Error os_self_exe_path(Buf *out_path) {
1456 if (sysctl(mib, 4, buf_ptr(out_path), &cb, nullptr, 0) != 0) {1456 if (sysctl(mib, 4, buf_ptr(out_path), &cb, nullptr, 0) != 0) {
1457 return ErrorUnexpected;1457 return ErrorUnexpected;
1458 }1458 }
1459 buf_resize(out_path, cb);1459 buf_resize(out_path, cb - 1);
1460 return ErrorNone;1460 return ErrorNone;
1461#endif1461#endif
1462 return ErrorFileNotFound;1462 return ErrorFileNotFound;
std/os/freebsd/index.zig+4-3
...@@ -9,6 +9,7 @@ pub use @import("errno.zig");...@@ -9,6 +9,7 @@ pub use @import("errno.zig");
99
10const std = @import("../../index.zig");10const std = @import("../../index.zig");
11const c = std.c;11const c = std.c;
12const maxInt = std.math.maxInt;
12pub const Kevent = c.Kevent;13pub const Kevent = c.Kevent;
1314
14pub const PATH_MAX = 1024;15pub const PATH_MAX = 1024;
...@@ -22,7 +23,7 @@ pub const PROT_READ = 1;...@@ -22,7 +23,7 @@ pub const PROT_READ = 1;
22pub const PROT_WRITE = 2;23pub const PROT_WRITE = 2;
23pub const PROT_EXEC = 4;24pub const PROT_EXEC = 4;
2425
25pub const MAP_FAILED = @maxValue(usize);26pub const MAP_FAILED = maxInt(usize);
26pub const MAP_SHARED = 0x0001;27pub const MAP_SHARED = 0x0001;
27pub const MAP_PRIVATE = 0x0002;28pub const MAP_PRIVATE = 0x0002;
28pub const MAP_FIXED = 0x0010;29pub const MAP_FIXED = 0x0010;
...@@ -700,7 +701,7 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti...@@ -700,7 +701,7 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti
700701
701const NSIG = 65;702const NSIG = 65;
702const sigset_t = [128 / @sizeOf(usize)]usize;703const sigset_t = [128 / @sizeOf(usize)]usize;
703const all_mask = []usize{@maxValue(usize)};704const all_mask = []usize{maxInt(usize)};
704const app_mask = []usize{0xfffffffc7fffffff};705const app_mask = []usize{0xfffffffc7fffffff};
705706
706/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.707/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
...@@ -711,7 +712,7 @@ pub const Sigaction = struct {...@@ -711,7 +712,7 @@ pub const Sigaction = struct {
711 flags: u32,712 flags: u32,
712};713};
713714
714pub const SIG_ERR = @intToPtr(extern fn (i32) void, @maxValue(usize));715pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize));
715pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0);716pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0);
716pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1);717pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1);
717pub const empty_sigset = []usize{0} ** sigset_t.len;718pub const empty_sigset = []usize{0} ** sigset_t.len;