Merge branch 'freebsd-up' of https://github.com/myfreeweb/zig into freebsd2

This commit is contained in:
Andrew Kelley
2018-11-19 17:24:41 -05:00
30 changed files with 1757 additions and 67 deletions
+3 -3
View File
@@ -70,7 +70,7 @@ pub const DirectAllocator = struct {
const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
switch (builtin.os) {
Os.linux, Os.macosx, Os.ios => {
Os.linux, Os.macosx, Os.ios, Os.freebsd => {
const p = os.posix;
const alloc_size = if (alignment <= os.page_size) n else n + alignment;
const addr = p.mmap(null, alloc_size, p.PROT_READ | p.PROT_WRITE, p.MAP_PRIVATE | p.MAP_ANONYMOUS, -1, 0);
@@ -121,7 +121,7 @@ pub const DirectAllocator = struct {
const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
switch (builtin.os) {
Os.linux, Os.macosx, Os.ios => {
Os.linux, Os.macosx, Os.ios, Os.freebsd => {
if (new_size <= old_mem.len) {
const base_addr = @ptrToInt(old_mem.ptr);
const old_addr_end = base_addr + old_mem.len;
@@ -166,7 +166,7 @@ pub const DirectAllocator = struct {
const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
switch (builtin.os) {
Os.linux, Os.macosx, Os.ios => {
Os.linux, Os.macosx, Os.ios, Os.freebsd => {
_ = os.posix.munmap(@ptrToInt(bytes.ptr), bytes.len);
},
Os.windows => {