Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abdelq committed May 12, 2020
1 parent 9340e10 commit d687230
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/std/os/bits/freebsd.zig
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ pub const sockaddr_un = extern struct {
pub const CTL_KERN = 1;
pub const CTL_DEBUG = 5;

pub const KERN_OSRELEASE = 2; // string: system release
pub const KERN_PROC = 14; // struct: process entries
pub const KERN_PROC_PATHNAME = 12; // path to executable

Expand Down
1 change: 1 addition & 0 deletions lib/std/os/bits/netbsd.zig
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ pub const AI_ADDRCONFIG = 0x00000400;
pub const CTL_KERN = 1;
pub const CTL_DEBUG = 5;

pub const KERN_OSRELEASE = 2; // string: system release
pub const KERN_PROC_ARGS = 48; // struct: process argv/env
pub const KERN_PROC_PATHNAME = 5; // path to executable

Expand Down
7 changes: 4 additions & 3 deletions lib/std/zig/system.zig
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,11 @@ pub const NativeTargetInfo = struct {
@panic("unable to get the system release string");
};

const release_version = if (mem.indexOfScalar(u8, buf, '-')) |pos|
buf[0 .. pos]
const release = buf[0 .. len - 1];
const release_version = if (mem.indexOfScalar(u8, release, '-')) |pos|
release[0..pos]
else
buf[0 .. len - 1];
release;

if (std.builtin.Version.parse(release_version)) |ver| {
os.version_range.semver.min = ver;
Expand Down
4 changes: 2 additions & 2 deletions test/stage1/behavior/type_info.zig
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ fn testEnum() void {
const os_info = @typeInfo(Os);
expect(os_info == .Enum);
expect(os_info.Enum.layout == .Auto);
expect(os_info.Enum.fields.len == 4);
expect(os_info.Enum.fields.len == 5);
expect(mem.eql(u8, os_info.Enum.fields[1].name, "Macos"));
expect(os_info.Enum.fields[3].value == 3);
expect(os_info.Enum.tag_type == u2);
expect(os_info.Enum.tag_type == u3);
expect(os_info.Enum.decls.len == 0);
}

Expand Down

0 comments on commit d687230

Please sign in to comment.