diff options
| author | Marcio <i@mgxm.me> | 2018-12-20 22:55:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-20 22:55:14 +0000 |
| commit | ac1b2a3c7319b099211acdca91c644a8533d0970 (patch) | |
| tree | b2e4f137b03592c11e7d3a81f351607d54b2ae80 /std | |
| parent | e5b4748101ca40f5dc4082ce2cb46df0c8607417 (diff) | |
| parent | 76efc462e7ea90be02fd28254f8c452ba994ea8a (diff) | |
| download | zig-ac1b2a3c7319b099211acdca91c644a8533d0970.tar.gz zig-ac1b2a3c7319b099211acdca91c644a8533d0970.zip | |
Merge pull request #1 from myfreeweb/fbsd2
Fix dirent/stat, add preadv
Diffstat (limited to 'std')
| -rw-r--r-- | std/c/freebsd.zig | 19 | ||||
| -rw-r--r-- | std/os/freebsd/index.zig | 4 |
2 files changed, 15 insertions, 8 deletions
diff --git a/std/c/freebsd.zig b/std/c/freebsd.zig index 86213ee1b3..f30d57da3b 100644 --- a/std/c/freebsd.zig +++ b/std/c/freebsd.zig @@ -15,6 +15,8 @@ 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; pub extern "c" fn getdirentries(fd: c_int, buf_ptr: [*]u8, nbytes: usize, basep: *i64) usize; pub extern "c" fn pipe2(arg0: *[2]c_int, arg1: u32) c_int; +pub extern "c" fn preadv(fd: c_int, iov: *const c_void, iovcnt: c_int, offset: usize) isize; +pub extern "c" fn pwritev(fd: c_int, iov: *const c_void, iovcnt: c_int, offset: usize) isize; /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. pub const Kevent = extern struct { @@ -50,18 +52,23 @@ pub const Stat = extern struct { nlink: usize, mode: u32, + __pad0: u16, uid: u32, gid: u32, - __pad0: u32, + __pad1: u32, rdev: u64, - size: i64, - blksize: isize, - blocks: i64, atim: timespec, mtim: timespec, ctim: timespec, - __unused: [3]isize, + birthtim: timespec, + + size: i64, + blocks: i64, + blksize: isize, + flags: u32, + gen: u64, + __spare: [10]u64, }; pub const timespec = extern struct { @@ -72,7 +79,7 @@ pub const timespec = extern struct { pub const dirent = extern struct { d_fileno: usize, d_off: i64, - d_reclen: u64, + d_reclen: u16, d_type: u8, d_pad0: u8, d_namlen: u16, diff --git a/std/os/freebsd/index.zig b/std/os/freebsd/index.zig index 47f4e8e267..1e08afe26d 100644 --- a/std/os/freebsd/index.zig +++ b/std/os/freebsd/index.zig @@ -626,7 +626,7 @@ pub fn pread(fd: i32, buf: [*]u8, nbyte: usize, offset: u64) usize { } pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: usize) usize { - return arch.syscall4(SYS_preadv, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset); + return errnoWrap(c.preadv(fd, @ptrCast(*const c_void, iov), @intCast(c_int, count), offset)); } pub fn pipe(fd: *[2]i32) usize { @@ -647,7 +647,7 @@ pub fn pwrite(fd: i32, buf: [*]const u8, nbyte: usize, offset: u64) usize { } pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: usize) usize { - return arch.syscall4(SYS_pwritev, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset); + return errnoWrap(c.pwritev(fd, @ptrCast(*const c_void, iov), @intCast(c_int, count), offset)); } pub fn rename(old: [*]const u8, new: [*]const u8) usize { |
