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.

pwrite

linux.pwrite
pub fn pwrite(fd: fd_t, buf: [*]const u8, count: usize, offset: off_t) usize

File

lib/std/os/linux.zig:1505

Code

pub fn pwrite(fd: fd_t, buf: [*]const u8, count: usize, offset: off_t) usize {
    if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
        const offset_halves = splitValue64(offset);
        if (require_aligned_register_pair) {
            return syscall6(
                .pwrite64,
                @as(u32, @bitCast(fd)),
                @intFromPtr(buf),
                count,
                0,
                offset_halves[0],
                offset_halves[1],
            );
        } else {
            return syscall5(
                .pwrite64,
                @as(u32, @bitCast(fd)),
                @intFromPtr(buf),
                count,
                offset_halves[0],
                offset_halves[1],
            );
        }
    } else {
        return syscall4(
            .pwrite64,
            @as(u32, @bitCast(fd)),
            @intFromPtr(buf),
            count,
            @as(u64, @bitCast(offset)),
        );
    }
}