Add preadv/pwritev on FreeBSD

master
Greg V 2018-12-20 23:55:44 +03:00
parent 054c7ab18a
commit 76efc462e7
2 changed files with 4 additions and 2 deletions

View File

@ -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 {

View File

@ -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 {