| author | |
| committer | |
| log | 4dafdc00d5c0d73511d64c5edf7481c8fe254a61 |
| tree | 0271d2f18d8044027610e5fb328be84ef54ae08d |
| parent | 9493738e5448ca166344a2d57abc44b29bb00081 |
| signature | Commit is signed but in an unrecognized format. |
6 files changed, 18 insertions(+), 29 deletions(-)
std/c/freebsd.zig+2-5| ... | @@ -1,4 +1,3 @@ | ... | @@ -1,4 +1,3 @@ |
| 1 | |||
| 2 | const timespec = @import("../os/freebsd/index.zig").timespec; | 1 | const timespec = @import("../os/freebsd/index.zig").timespec; |
| 3 | 2 | ||
| 4 | extern "c" fn __error() *c_int; | 3 | extern "c" fn __error() *c_int; |
| ... | @@ -18,7 +17,7 @@ pub extern "c" fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usi | ... | @@ -18,7 +17,7 @@ pub extern "c" fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usi |
| 18 | pub extern "c" fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) c_int; | 17 | pub extern "c" fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) c_int; |
| 19 | 18 | ||
| 20 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | 19 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. |
| 21 | pub const Kevent = extern struct.{ | 20 | pub const Kevent = extern struct { |
| 22 | ident: usize, | 21 | ident: usize, |
| 23 | filter: i16, | 22 | filter: i16, |
| 24 | flags: u16, | 23 | flags: u16, |
| ... | @@ -28,9 +27,7 @@ pub const Kevent = extern struct.{ | ... | @@ -28,9 +27,7 @@ pub const Kevent = extern struct.{ |
| 28 | // TODO ext | 27 | // TODO ext |
| 29 | }; | 28 | }; |
| 30 | 29 | ||
| 31 | 30 | pub const pthread_attr_t = extern struct { | |
| 32 | pub const pthread_attr_t = extern struct.{ | ||
| 33 | __size: [56]u8, | 31 | __size: [56]u8, |
| 34 | __align: c_long, | 32 | __align: c_long, |
| 35 | }; | 33 | }; |
| 36 |
std/debug/index.zig+1-2| ... | @@ -1101,8 +1101,7 @@ pub const DebugInfo = switch (builtin.os) { | ... | @@ -1101,8 +1101,7 @@ pub const DebugInfo = switch (builtin.os) { |
| 1101 | self.elf.close(); | 1101 | self.elf.close(); |
| 1102 | } | 1102 | } |
| 1103 | }, | 1103 | }, |
| 1104 | builtin.Os.freebsd => struct.{ | 1104 | builtin.Os.freebsd => struct {}, |
| 1105 | }, | ||
| 1106 | else => @compileError("Unsupported OS"), | 1105 | else => @compileError("Unsupported OS"), |
| 1107 | }; | 1106 | }; |
| 1108 | 1107 |
std/mem.zig+4-4| ... | @@ -475,8 +475,8 @@ test "readIntBE/LE" { | ... | @@ -475,8 +475,8 @@ test "readIntBE/LE" { |
| 475 | assert(readIntBE(u8, []u8{0x32}) == 0x32); | 475 | assert(readIntBE(u8, []u8{0x32}) == 0x32); |
| 476 | assert(readIntLE(u8, []u8{0x12}) == 0x12); | 476 | assert(readIntLE(u8, []u8{0x12}) == 0x12); |
| 477 | 477 | ||
| 478 | assert(readIntBE(u16, []u8{0x12, 0x34}) == 0x1234); | 478 | assert(readIntBE(u16, []u8{ 0x12, 0x34 }) == 0x1234); |
| 479 | assert(readIntLE(u16, []u8{0x12, 0x34}) == 0x3412); | 479 | assert(readIntLE(u16, []u8{ 0x12, 0x34 }) == 0x3412); |
| 480 | 480 | ||
| 481 | assert(readIntBE(u72, []u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 }) == 0x123456789abcdef024); | 481 | assert(readIntBE(u72, []u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 }) == 0x123456789abcdef024); |
| 482 | assert(readIntLE(u72, []u8{ 0xec, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe }) == 0xfedcba9876543210ec); | 482 | assert(readIntLE(u72, []u8{ 0xec, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe }) == 0xfedcba9876543210ec); |
| ... | @@ -484,8 +484,8 @@ test "readIntBE/LE" { | ... | @@ -484,8 +484,8 @@ test "readIntBE/LE" { |
| 484 | assert(readIntBE(i8, []u8{0xff}) == -1); | 484 | assert(readIntBE(i8, []u8{0xff}) == -1); |
| 485 | assert(readIntLE(i8, []u8{0xfe}) == -2); | 485 | assert(readIntLE(i8, []u8{0xfe}) == -2); |
| 486 | 486 | ||
| 487 | assert(readIntBE(i16, []u8{0xff, 0xfd}) == -3); | 487 | assert(readIntBE(i16, []u8{ 0xff, 0xfd }) == -3); |
| 488 | assert(readIntLE(i16, []u8{0xfc, 0xff}) == -4); | 488 | assert(readIntLE(i16, []u8{ 0xfc, 0xff }) == -4); |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | /// Writes an integer to memory with size equal to bytes.len. Pads with zeroes | 491 | /// Writes an integer to memory with size equal to bytes.len. Pads with zeroes |
std/os/freebsd/index.zig+7-14| ... | @@ -377,7 +377,6 @@ pub const NOTE_FFCOPY = 0xc0000000; | ... | @@ -377,7 +377,6 @@ pub const NOTE_FFCOPY = 0xc0000000; |
| 377 | pub const NOTE_FFCTRLMASK = 0xc0000000; | 377 | pub const NOTE_FFCTRLMASK = 0xc0000000; |
| 378 | pub const NOTE_FFLAGSMASK = 0x00ffffff; | 378 | pub const NOTE_FFLAGSMASK = 0x00ffffff; |
| 379 | 379 | ||
| 380 | |||
| 381 | /// low water mark | 380 | /// low water mark |
| 382 | pub const NOTE_LOWAT = 0x00000001; | 381 | pub const NOTE_LOWAT = 0x00000001; |
| 383 | 382 | ||
| ... | @@ -445,8 +444,6 @@ pub const NOTE_NSECONDS = 0x00000008; | ... | @@ -445,8 +444,6 @@ pub const NOTE_NSECONDS = 0x00000008; |
| 445 | /// timeout is absolute | 444 | /// timeout is absolute |
| 446 | pub const NOTE_ABSTIME = 0x00000010; | 445 | pub const NOTE_ABSTIME = 0x00000010; |
| 447 | 446 | ||
| 448 | |||
| 449 | |||
| 450 | pub const TCGETS = 0x5401; | 447 | pub const TCGETS = 0x5401; |
| 451 | pub const TCSETS = 0x5402; | 448 | pub const TCSETS = 0x5402; |
| 452 | pub const TCSETSW = 0x5403; | 449 | pub const TCSETSW = 0x5403; |
| ... | @@ -528,7 +525,7 @@ pub fn WIFSIGNALED(s: i32) bool { | ... | @@ -528,7 +525,7 @@ pub fn WIFSIGNALED(s: i32) bool { |
| 528 | return (unsigned(s) & 0xffff) -% 1 < 0xff; | 525 | return (unsigned(s) & 0xffff) -% 1 < 0xff; |
| 529 | } | 526 | } |
| 530 | 527 | ||
| 531 | pub const winsize = extern struct.{ | 528 | pub const winsize = extern struct { |
| 532 | ws_row: u16, | 529 | ws_row: u16, |
| 533 | ws_col: u16, | 530 | ws_col: u16, |
| 534 | ws_xpixel: u16, | 531 | ws_xpixel: u16, |
| ... | @@ -703,11 +700,11 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti | ... | @@ -703,11 +700,11 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti |
| 703 | 700 | ||
| 704 | const NSIG = 65; | 701 | const NSIG = 65; |
| 705 | const sigset_t = [128 / @sizeOf(usize)]usize; | 702 | const sigset_t = [128 / @sizeOf(usize)]usize; |
| 706 | const all_mask = []usize.{@maxValue(usize)}; | 703 | const all_mask = []usize{@maxValue(usize)}; |
| 707 | const app_mask = []usize.{0xfffffffc7fffffff}; | 704 | const app_mask = []usize{0xfffffffc7fffffff}; |
| 708 | 705 | ||
| 709 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | 706 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 710 | pub const Sigaction = struct.{ | 707 | pub const Sigaction = struct { |
| 711 | // TODO: Adjust to use freebsd struct layout | 708 | // TODO: Adjust to use freebsd struct layout |
| 712 | handler: extern fn (i32) void, | 709 | handler: extern fn (i32) void, |
| 713 | mask: sigset_t, | 710 | mask: sigset_t, |
| ... | @@ -717,7 +714,7 @@ pub const Sigaction = struct.{ | ... | @@ -717,7 +714,7 @@ pub const Sigaction = struct.{ |
| 717 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, @maxValue(usize)); | 714 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, @maxValue(usize)); |
| 718 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | 715 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); |
| 719 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | 716 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); |
| 720 | pub const empty_sigset = []usize.{0} ** sigset_t.len; | 717 | pub const empty_sigset = []usize{0} ** sigset_t.len; |
| 721 | 718 | ||
| 722 | pub fn raise(sig: i32) usize { | 719 | pub fn raise(sig: i32) usize { |
| 723 | // TODO implement, see linux equivalent for what we want to try and do | 720 | // TODO implement, see linux equivalent for what we want to try and do |
| ... | @@ -753,12 +750,12 @@ pub fn fstat(fd: i32, stat_buf: *Stat) usize { | ... | @@ -753,12 +750,12 @@ pub fn fstat(fd: i32, stat_buf: *Stat) usize { |
| 753 | return arch.syscall2(SYS_fstat, @intCast(usize, fd), @ptrToInt(stat_buf)); | 750 | return arch.syscall2(SYS_fstat, @intCast(usize, fd), @ptrToInt(stat_buf)); |
| 754 | } | 751 | } |
| 755 | 752 | ||
| 756 | pub const iovec = extern struct.{ | 753 | pub const iovec = extern struct { |
| 757 | iov_base: [*]u8, | 754 | iov_base: [*]u8, |
| 758 | iov_len: usize, | 755 | iov_len: usize, |
| 759 | }; | 756 | }; |
| 760 | 757 | ||
| 761 | pub const iovec_const = extern struct.{ | 758 | pub const iovec_const = extern struct { |
| 762 | iov_base: [*]const u8, | 759 | iov_base: [*]const u8, |
| 763 | iov_len: usize, | 760 | iov_len: usize, |
| 764 | }; | 761 | }; |
| ... | @@ -790,13 +787,9 @@ pub fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) usize { | ... | @@ -790,13 +787,9 @@ pub fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) usize { |
| 790 | return errnoWrap(c.sysctlnametomib(name, wibp, sizep)); | 787 | return errnoWrap(c.sysctlnametomib(name, wibp, sizep)); |
| 791 | } | 788 | } |
| 792 | 789 | ||
| 793 | |||
| 794 | |||
| 795 | /// Takes the return value from a syscall and formats it back in the way | 790 | /// Takes the return value from a syscall and formats it back in the way |
| 796 | /// that the kernel represents it to libc. Errno was a mistake, let's make | 791 | /// that the kernel represents it to libc. Errno was a mistake, let's make |
| 797 | /// it go away forever. | 792 | /// it go away forever. |
| 798 | fn errnoWrap(value: isize) usize { | 793 | fn errnoWrap(value: isize) usize { |
| 799 | return @bitCast(usize, if (value == -1) -isize(c._errno().*) else value); | 794 | return @bitCast(usize, if (value == -1) -isize(c._errno().*) else value); |
| 800 | } | 795 | } |
| 801 | |||
| 802 |
std/os/freebsd/x86_64.zig+3-3| ... | @@ -97,7 +97,7 @@ pub nakedcc fn restore_rt() void { | ... | @@ -97,7 +97,7 @@ pub nakedcc fn restore_rt() void { |
| 97 | ); | 97 | ); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | pub const msghdr = extern struct.{ | 100 | pub const msghdr = extern struct { |
| 101 | msg_name: &u8, | 101 | msg_name: &u8, |
| 102 | msg_namelen: socklen_t, | 102 | msg_namelen: socklen_t, |
| 103 | msg_iov: &iovec, | 103 | msg_iov: &iovec, |
| ... | @@ -110,7 +110,7 @@ pub const msghdr = extern struct.{ | ... | @@ -110,7 +110,7 @@ pub const msghdr = extern struct.{ |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | /// Renamed to Stat to not conflict with the stat function. | 112 | /// Renamed to Stat to not conflict with the stat function. |
| 113 | pub const Stat = extern struct.{ | 113 | pub const Stat = extern struct { |
| 114 | dev: u64, | 114 | dev: u64, |
| 115 | ino: u64, | 115 | ino: u64, |
| 116 | nlink: usize, | 116 | nlink: usize, |
| ... | @@ -130,7 +130,7 @@ pub const Stat = extern struct.{ | ... | @@ -130,7 +130,7 @@ pub const Stat = extern struct.{ |
| 130 | __unused: [3]isize, | 130 | __unused: [3]isize, |
| 131 | }; | 131 | }; |
| 132 | 132 | ||
| 133 | pub const timespec = extern struct.{ | 133 | pub const timespec = extern struct { |
| 134 | tv_sec: isize, | 134 | tv_sec: isize, |
| 135 | tv_nsec: isize, | 135 | tv_nsec: isize, |
| 136 | }; | 136 | }; |
std/special/bootstrap.zig+1-1| ... | @@ -23,7 +23,7 @@ nakedcc fn _start() noreturn { | ... | @@ -23,7 +23,7 @@ nakedcc fn _start() noreturn { |
| 23 | builtin.Arch.x86_64 => switch (builtin.os) { | 23 | builtin.Arch.x86_64 => switch (builtin.os) { |
| 24 | builtin.Os.freebsd => { | 24 | builtin.Os.freebsd => { |
| 25 | argc_ptr = asm ("lea (%%rdi), %[argc]" | 25 | argc_ptr = asm ("lea (%%rdi), %[argc]" |
| 26 | : [argc] "=r" (-> [*]usize) | 26 | : [argc] "=r" (-> [*]usize) |
| 27 | ); | 27 | ); |
| 28 | }, | 28 | }, |
| 29 | else => { | 29 | else => { |