zig fmt
This commit is contained in:
parent
9493738e54
commit
4dafdc00d5
@ -1,4 +1,3 @@
|
||||
|
||||
const timespec = @import("../os/freebsd/index.zig").timespec;
|
||||
|
||||
extern "c" fn __error() *c_int;
|
||||
@ -18,7 +17,7 @@ pub extern "c" fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usi
|
||||
pub extern "c" fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) c_int;
|
||||
|
||||
/// Renamed from `kevent` to `Kevent` to avoid conflict with function name.
|
||||
pub const Kevent = extern struct.{
|
||||
pub const Kevent = extern struct {
|
||||
ident: usize,
|
||||
filter: i16,
|
||||
flags: u16,
|
||||
@ -28,9 +27,7 @@ pub const Kevent = extern struct.{
|
||||
// TODO ext
|
||||
};
|
||||
|
||||
|
||||
pub const pthread_attr_t = extern struct.{
|
||||
pub const pthread_attr_t = extern struct {
|
||||
__size: [56]u8,
|
||||
__align: c_long,
|
||||
};
|
||||
|
||||
|
@ -1101,8 +1101,7 @@ pub const DebugInfo = switch (builtin.os) {
|
||||
self.elf.close();
|
||||
}
|
||||
},
|
||||
builtin.Os.freebsd => struct.{
|
||||
},
|
||||
builtin.Os.freebsd => struct {},
|
||||
else => @compileError("Unsupported OS"),
|
||||
};
|
||||
|
||||
|
@ -475,8 +475,8 @@ test "readIntBE/LE" {
|
||||
assert(readIntBE(u8, []u8{0x32}) == 0x32);
|
||||
assert(readIntLE(u8, []u8{0x12}) == 0x12);
|
||||
|
||||
assert(readIntBE(u16, []u8{0x12, 0x34}) == 0x1234);
|
||||
assert(readIntLE(u16, []u8{0x12, 0x34}) == 0x3412);
|
||||
assert(readIntBE(u16, []u8{ 0x12, 0x34 }) == 0x1234);
|
||||
assert(readIntLE(u16, []u8{ 0x12, 0x34 }) == 0x3412);
|
||||
|
||||
assert(readIntBE(u72, []u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 }) == 0x123456789abcdef024);
|
||||
assert(readIntLE(u72, []u8{ 0xec, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe }) == 0xfedcba9876543210ec);
|
||||
@ -484,8 +484,8 @@ test "readIntBE/LE" {
|
||||
assert(readIntBE(i8, []u8{0xff}) == -1);
|
||||
assert(readIntLE(i8, []u8{0xfe}) == -2);
|
||||
|
||||
assert(readIntBE(i16, []u8{0xff, 0xfd}) == -3);
|
||||
assert(readIntLE(i16, []u8{0xfc, 0xff}) == -4);
|
||||
assert(readIntBE(i16, []u8{ 0xff, 0xfd }) == -3);
|
||||
assert(readIntLE(i16, []u8{ 0xfc, 0xff }) == -4);
|
||||
}
|
||||
|
||||
/// Writes an integer to memory with size equal to bytes.len. Pads with zeroes
|
||||
|
@ -377,7 +377,6 @@ pub const NOTE_FFCOPY = 0xc0000000;
|
||||
pub const NOTE_FFCTRLMASK = 0xc0000000;
|
||||
pub const NOTE_FFLAGSMASK = 0x00ffffff;
|
||||
|
||||
|
||||
/// low water mark
|
||||
pub const NOTE_LOWAT = 0x00000001;
|
||||
|
||||
@ -445,8 +444,6 @@ pub const NOTE_NSECONDS = 0x00000008;
|
||||
/// timeout is absolute
|
||||
pub const NOTE_ABSTIME = 0x00000010;
|
||||
|
||||
|
||||
|
||||
pub const TCGETS = 0x5401;
|
||||
pub const TCSETS = 0x5402;
|
||||
pub const TCSETSW = 0x5403;
|
||||
@ -528,7 +525,7 @@ pub fn WIFSIGNALED(s: i32) bool {
|
||||
return (unsigned(s) & 0xffff) -% 1 < 0xff;
|
||||
}
|
||||
|
||||
pub const winsize = extern struct.{
|
||||
pub const winsize = extern struct {
|
||||
ws_row: u16,
|
||||
ws_col: u16,
|
||||
ws_xpixel: u16,
|
||||
@ -703,11 +700,11 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti
|
||||
|
||||
const NSIG = 65;
|
||||
const sigset_t = [128 / @sizeOf(usize)]usize;
|
||||
const all_mask = []usize.{@maxValue(usize)};
|
||||
const app_mask = []usize.{0xfffffffc7fffffff};
|
||||
const all_mask = []usize{@maxValue(usize)};
|
||||
const app_mask = []usize{0xfffffffc7fffffff};
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
|
||||
pub const Sigaction = struct.{
|
||||
pub const Sigaction = struct {
|
||||
// TODO: Adjust to use freebsd struct layout
|
||||
handler: extern fn (i32) void,
|
||||
mask: sigset_t,
|
||||
@ -717,7 +714,7 @@ pub const Sigaction = struct.{
|
||||
pub const SIG_ERR = @intToPtr(extern fn (i32) void, @maxValue(usize));
|
||||
pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0);
|
||||
pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1);
|
||||
pub const empty_sigset = []usize.{0} ** sigset_t.len;
|
||||
pub const empty_sigset = []usize{0} ** sigset_t.len;
|
||||
|
||||
pub fn raise(sig: i32) usize {
|
||||
// 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 {
|
||||
return arch.syscall2(SYS_fstat, @intCast(usize, fd), @ptrToInt(stat_buf));
|
||||
}
|
||||
|
||||
pub const iovec = extern struct.{
|
||||
pub const iovec = extern struct {
|
||||
iov_base: [*]u8,
|
||||
iov_len: usize,
|
||||
};
|
||||
|
||||
pub const iovec_const = extern struct.{
|
||||
pub const iovec_const = extern struct {
|
||||
iov_base: [*]const u8,
|
||||
iov_len: usize,
|
||||
};
|
||||
@ -790,13 +787,9 @@ pub fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usize) usize {
|
||||
return errnoWrap(c.sysctlnametomib(name, wibp, sizep));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Takes the return value from a syscall and formats it back in the way
|
||||
/// that the kernel represents it to libc. Errno was a mistake, let's make
|
||||
/// it go away forever.
|
||||
fn errnoWrap(value: isize) usize {
|
||||
return @bitCast(usize, if (value == -1) -isize(c._errno().*) else value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ pub nakedcc fn restore_rt() void {
|
||||
);
|
||||
}
|
||||
|
||||
pub const msghdr = extern struct.{
|
||||
pub const msghdr = extern struct {
|
||||
msg_name: &u8,
|
||||
msg_namelen: socklen_t,
|
||||
msg_iov: &iovec,
|
||||
@ -110,7 +110,7 @@ pub const msghdr = extern struct.{
|
||||
};
|
||||
|
||||
/// Renamed to Stat to not conflict with the stat function.
|
||||
pub const Stat = extern struct.{
|
||||
pub const Stat = extern struct {
|
||||
dev: u64,
|
||||
ino: u64,
|
||||
nlink: usize,
|
||||
@ -130,7 +130,7 @@ pub const Stat = extern struct.{
|
||||
__unused: [3]isize,
|
||||
};
|
||||
|
||||
pub const timespec = extern struct.{
|
||||
pub const timespec = extern struct {
|
||||
tv_sec: isize,
|
||||
tv_nsec: isize,
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ nakedcc fn _start() noreturn {
|
||||
builtin.Arch.x86_64 => switch (builtin.os) {
|
||||
builtin.Os.freebsd => {
|
||||
argc_ptr = asm ("lea (%%rdi), %[argc]"
|
||||
: [argc] "=r" (-> [*]usize)
|
||||
: [argc] "=r" (-> [*]usize)
|
||||
);
|
||||
},
|
||||
else => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user