Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

fallocate

linux.fallocate
pub fn fallocate(fd: fd_t, mode: mode_t, offset: off_t, length: off_t) usize

File

lib/std/os/linux.zig:843

Code

pub fn fallocate(fd: fd_t, mode: mode_t, offset: off_t, length: off_t) usize {
    if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
        const offset_halves = splitValue64(offset);
        const length_halves = splitValue64(length);
        return syscall6(
            .fallocate,
            @as(u32, @bitCast(fd)),
            mode,
            offset_halves[0],
            offset_halves[1],
            length_halves[0],
            length_halves[1],
        );
    } else {
        return syscall4(
            .fallocate,
            @as(u32, @bitCast(fd)),
            mode,
            @as(u64, @bitCast(offset)),
            @as(u64, @bitCast(length)),
        );
    }
}