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

36
std/c/freebsd.zig Normal file
View File

@@ -0,0 +1,36 @@
const timespec = @import("../os/freebsd/index.zig").timespec;
extern "c" fn __error() *c_int;
pub const _errno = __error;
pub extern "c" fn kqueue() c_int;
pub extern "c" fn kevent(
kq: c_int,
changelist: [*]const Kevent,
nchanges: c_int,
eventlist: [*]Kevent,
nevents: c_int,
timeout: ?*const timespec,
) c_int;
pub extern "c" fn sysctl(name: [*]c_int, namelen: c_uint, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int;
pub extern "c" fn sysctlbyname(name: [*]const u8, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int;
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.{
ident: usize,
filter: i16,
flags: u16,
fflags: u32,
data: i64,
udata: usize,
// TODO ext
};
pub const pthread_attr_t = extern struct.{
__size: [56]u8,
__align: c_long,
};

View File

@@ -5,6 +5,7 @@ pub use switch (builtin.os) {
Os.linux => @import("linux.zig"),
Os.windows => @import("windows.zig"),
Os.macosx, Os.ios => @import("darwin.zig"),
Os.freebsd => @import("freebsd.zig"),
else => empty_import,
};
const empty_import = @import("../empty.zig");