authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-11-19 17:28:18-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-11-19 17:28:18-05:00
log4dafdc00d5c0d73511d64c5edf7481c8fe254a61
tree0271d2f18d8044027610e5fb328be84ef54ae08d
parent9493738e5448ca166344a2d57abc44b29bb00081
signature Commit is signed but in an unrecognized format.

zig fmt


6 files changed, 18 insertions(+), 29 deletions(-)

std/c/freebsd.zig+2-5
......@@ -1,4 +1,3 @@
1
21const timespec = @import("../os/freebsd/index.zig").timespec;
32
43extern "c" fn __error() *c_int;
......@@ -18,7 +17,7 @@ pub extern "c" fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usi
1817pub extern "c" fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) c_int;
1918
2019/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
21pub const Kevent = extern struct.{
20pub const Kevent = extern struct {
2221 ident: usize,
2322 filter: i16,
2423 flags: u16,
......@@ -28,9 +27,7 @@ pub const Kevent = extern struct.{
2827 // TODO ext
2928};
3029
31
32pub const pthread_attr_t = extern struct.{
30pub const pthread_attr_t = extern struct {
3331 __size: [56]u8,
3432 __align: c_long,
3533};
36
std/debug/index.zig+1-2
......@@ -1101,8 +1101,7 @@ pub const DebugInfo = switch (builtin.os) {
11011101 self.elf.close();
11021102 }
11031103 },
1104 builtin.Os.freebsd => struct.{
1105 },
1104 builtin.Os.freebsd => struct {},
11061105 else => @compileError("Unsupported OS"),
11071106};
11081107
std/mem.zig+4-4
......@@ -475,8 +475,8 @@ test "readIntBE/LE" {
475475 assert(readIntBE(u8, []u8{0x32}) == 0x32);
476476 assert(readIntLE(u8, []u8{0x12}) == 0x12);
477477
478 assert(readIntBE(u16, []u8{0x12, 0x34}) == 0x1234);
479 assert(readIntLE(u16, []u8{0x12, 0x34}) == 0x3412);
478 assert(readIntBE(u16, []u8{ 0x12, 0x34 }) == 0x1234);
479 assert(readIntLE(u16, []u8{ 0x12, 0x34 }) == 0x3412);
480480
481481 assert(readIntBE(u72, []u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 }) == 0x123456789abcdef024);
482482 assert(readIntLE(u72, []u8{ 0xec, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe }) == 0xfedcba9876543210ec);
......@@ -484,8 +484,8 @@ test "readIntBE/LE" {
484484 assert(readIntBE(i8, []u8{0xff}) == -1);
485485 assert(readIntLE(i8, []u8{0xfe}) == -2);
486486
487 assert(readIntBE(i16, []u8{0xff, 0xfd}) == -3);
488 assert(readIntLE(i16, []u8{0xfc, 0xff}) == -4);
487 assert(readIntBE(i16, []u8{ 0xff, 0xfd }) == -3);
488 assert(readIntLE(i16, []u8{ 0xfc, 0xff }) == -4);
489489}
490490
491491/// 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;
377377pub const NOTE_FFCTRLMASK = 0xc0000000;
378378pub const NOTE_FFLAGSMASK = 0x00ffffff;
379379
380
381380/// low water mark
382381pub const NOTE_LOWAT = 0x00000001;
383382
......@@ -445,8 +444,6 @@ pub const NOTE_NSECONDS = 0x00000008;
445444/// timeout is absolute
446445pub const NOTE_ABSTIME = 0x00000010;
447446
448
449
450447pub const TCGETS = 0x5401;
451448pub const TCSETS = 0x5402;
452449pub const TCSETSW = 0x5403;
......@@ -528,7 +525,7 @@ pub fn WIFSIGNALED(s: i32) bool {
528525 return (unsigned(s) & 0xffff) -% 1 < 0xff;
529526}
530527
531pub const winsize = extern struct.{
528pub const winsize = extern struct {
532529 ws_row: u16,
533530 ws_col: u16,
534531 ws_xpixel: u16,
......@@ -703,11 +700,11 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti
703700
704701const NSIG = 65;
705702const sigset_t = [128 / @sizeOf(usize)]usize;
706const all_mask = []usize.{@maxValue(usize)};
707const app_mask = []usize.{0xfffffffc7fffffff};
703const all_mask = []usize{@maxValue(usize)};
704const app_mask = []usize{0xfffffffc7fffffff};
708705
709706/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
710pub const Sigaction = struct.{
707pub const Sigaction = struct {
711708 // TODO: Adjust to use freebsd struct layout
712709 handler: extern fn (i32) void,
713710 mask: sigset_t,
......@@ -717,7 +714,7 @@ pub const Sigaction = struct.{
717714pub const SIG_ERR = @intToPtr(extern fn (i32) void, @maxValue(usize));
718715pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0);
719716pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1);
720pub const empty_sigset = []usize.{0} ** sigset_t.len;
717pub const empty_sigset = []usize{0} ** sigset_t.len;
721718
722719pub fn raise(sig: i32) usize {
723720 // 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 {
753750 return arch.syscall2(SYS_fstat, @intCast(usize, fd), @ptrToInt(stat_buf));
754751}
755752
756pub const iovec = extern struct.{
753pub const iovec = extern struct {
757754 iov_base: [*]u8,
758755 iov_len: usize,
759756};
760757
761pub const iovec_const = extern struct.{
758pub const iovec_const = extern struct {
762759 iov_base: [*]const u8,
763760 iov_len: usize,
764761};
......@@ -790,13 +787,9 @@ pub fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) usize {
790787 return errnoWrap(c.sysctlnametomib(name, wibp, sizep));
791788}
792789
793
794
795790/// Takes the return value from a syscall and formats it back in the way
796791/// that the kernel represents it to libc. Errno was a mistake, let's make
797792/// it go away forever.
798793fn errnoWrap(value: isize) usize {
799794 return @bitCast(usize, if (value == -1) -isize(c._errno().*) else value);
800795}
801
802
std/os/freebsd/x86_64.zig+3-3
......@@ -97,7 +97,7 @@ pub nakedcc fn restore_rt() void {
9797 );
9898}
9999
100pub const msghdr = extern struct.{
100pub const msghdr = extern struct {
101101 msg_name: &u8,
102102 msg_namelen: socklen_t,
103103 msg_iov: &iovec,
......@@ -110,7 +110,7 @@ pub const msghdr = extern struct.{
110110};
111111
112112/// Renamed to Stat to not conflict with the stat function.
113pub const Stat = extern struct.{
113pub const Stat = extern struct {
114114 dev: u64,
115115 ino: u64,
116116 nlink: usize,
......@@ -130,7 +130,7 @@ pub const Stat = extern struct.{
130130 __unused: [3]isize,
131131};
132132
133pub const timespec = extern struct.{
133pub const timespec = extern struct {
134134 tv_sec: isize,
135135 tv_nsec: isize,
136136};
std/special/bootstrap.zig+1-1
......@@ -23,7 +23,7 @@ nakedcc fn _start() noreturn {
2323 builtin.Arch.x86_64 => switch (builtin.os) {
2424 builtin.Os.freebsd => {
2525 argc_ptr = asm ("lea (%%rdi), %[argc]"
26 : [argc] "=r" (-> [*]usize)
26 : [argc] "=r" (-> [*]usize)
2727 );
2828 },
2929 else => {