Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

buf_ring_add

Public Function
std.os.linux.IoUring.buf_ring_add
pub fn buf_ring_add(
    br: *linux.io_uring_buf_ring,
    buffer: []u8,
    buffer_id: u16,
    mask: u16,
    buffer_offset: u16,
) void

Assigns buffer with the br buffer ring. buffer_id is identifier which will be returned in the CQE. buffer_offset is the offset to insert at from the current tail. If just one buffer is provided before the ring tail is committed with advance then offset should be 0. If buffers are provided in a loop before being committed, the offset must be incremented by one for each buffer added.

Params

  • br: *linux.io_uring_buf_ring
  • buffer: []u8
  • buffer_id: u16
  • mask: u16
  • buffer_offset: u16

File

os/linux/IoUring.zig:1836
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
pub fn buf_ring_add(
    br: *linux.io_uring_buf_ring,
    buffer: []u8,
    buffer_id: u16,
    mask: u16,
    buffer_offset: u16,
) void {
    const bufs: [*]linux.io_uring_buf = @ptrCast(br);
    const buf: *linux.io_uring_buf = &bufs[(br.tail +% buffer_offset) & mask];

    buf.addr = @intFromPtr(buffer.ptr);
    buf.len = @intCast(buffer.len);
    buf.bid = buffer_id;
}