Expand description
Low-level unsafe FFI bindings for zbq.h.
zbq is a Linux-specific single-producer / multi-consumer (SPMC) shared-memory
ring-buffer with optional file-descriptor passing.
This crate compiles zbq.h (by defining ZBQ_IMPLEMENTATION) via the cc
build-dependency and exposes the raw C symbols through extern "C" blocks.
For safe, idiomatic Rust wrappers see the zbq crate.
Structs§
- zbq_
consumer - Opaque handle for a ring-buffer consumer.
- zbq_
consumer_ metadata - 4096-byte per-consumer metadata page, page aligned.
- zbq_
contiguous_ run - Result of a producer reservation query.
- zbq_
control_ region - 256-byte control region, cache-line aligned.
- zbq_
join_ payload - Payload sent from producer to consumer during the join handshake.
- zbq_
msg_ header - 16-byte packed message header, 16-byte aligned.
- zbq_
msg_ view - Read-only view of a message inside the ring.
- zbq_
producer - Opaque handle for a ring-buffer producer.
- zbq_
producer_ params - Parameters supplied to
zbq_producer_create.
Enums§
- zbq_
commit_ flags - Flags that modify
zbq_producer_commitbehaviour. - zbq_
error - Result / error codes returned by the C API.
- zbq_
wakeup_ mode - Consumer blocking strategy.
Constants§
- ZBQ_
MAX_ FD_ PER_ MSG - Maximum number of file descriptors that may be attached to a single message.
- ZBQ_
MSG_ ALIGN - Message alignment requirement in bytes.
Functions§
- zbq_
consumer_ ⚠acquire_ head - Load the current producer head with acquire semantics.
- zbq_
consumer_ ⚠ctrl - Return a read-only pointer to the shared control region.
- zbq_
consumer_ ⚠destroy - Destroy a consumer and release all associated resources.
- zbq_
consumer_ ⚠get_ futex_ token - Read the current broadcast futex token.
- zbq_
consumer_ ⚠is_ producer_ alive - Check whether the producer process is still alive.
- zbq_
consumer_ ⚠join - Join a ring-buffer as a consumer.
- zbq_
consumer_ ⚠meta - Return a mutable pointer to this consumer’s private metadata page.
- zbq_
consumer_ ⚠peek - Inspect the message at the consumer’s current tail.
- zbq_
consumer_ ⚠publish - Atomically publish the new consumer tail and progress timestamp.
- zbq_
consumer_ ⚠recv_ fds - Do not use this on untrusted producers.
- zbq_
consumer_ ⚠tail - Load the consumer’s local tail with acquire semantics.
- zbq_
consumer_ ⚠wait_ broadcast - Block until the producer commits new data (push mode).
- zbq_
producer_ ⚠broadcast_ fds - Broadcast file descriptors to all push-mode consumers.
- zbq_
producer_ ⚠commit - Commit
written_bytespreviously written into the contiguous run returned by the most recentzbq_producer_query. - zbq_
producer_ ⚠create - Create a new producer ring-buffer.
- zbq_
producer_ ⚠destroy - Destroy a producer and release all associated resources (mappings, pidfds, sockets, slots).
- zbq_
producer_ ⚠handshake - Complete the join handshake for an incoming consumer connection.
- zbq_
producer_ ⚠next_ seq_ id - Atomically increment and return the next sequence ID for FD-bearing messages.
- zbq_
producer_ ⚠query - Query the largest physically contiguous writable run available to the producer.
- zbq_
producer_ ⚠scan - Scan for dead or hung consumers and evict them.