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.

poll

linux.poll
pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize

File

lib/std/os/linux.zig:1399

Code

pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize {
    if (@hasField(SYS, "poll")) {
        return syscall3(.poll, @intFromPtr(fds), n, @as(u32, @bitCast(timeout)));
    } else {
        var ts: timespec = if (timeout >= 0)
            .{
                .sec = @divTrunc(timeout, 1000),
                .nsec = @rem(timeout, 1000) * 1000000,
            }
        else
            undefined;
        return ppoll(
            fds,
            n,
            if (timeout >= 0) &ts else null,
            null,
        );
    }
}