zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 8fd88fdb31e638e9483e08fc42de2514fd4a616a (tree)
parent 7c8d9cfa40ab96aede2a7fe8ec9dce6f10bc910a
Author: Joran Dirk Greef <joran@ronomon.com>
Date:   Sat, 31 Oct 2020 13:39:33 +0200

linux: add fallocate()

Diffstat:
Mlib/std/os/linux.zig | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig @@ -121,6 +121,16 @@ pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: *const [2]timespec, fl return syscall4(.utimensat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(times), flags); } +pub fn fallocate(fd: i32, mode: i32, offset: usize, len: usize) usize { + return syscall4( + .fallocate, + @bitCast(usize, @as(isize, fd)), + @bitCast(usize, @as(isize, mode)), + offset, + len, + ); +} + pub fn futex_wait(uaddr: *const i32, futex_op: u32, val: i32, timeout: ?*timespec) usize { return syscall4(.futex, @ptrToInt(uaddr), futex_op, @bitCast(u32, val), @ptrToInt(timeout)); }