Skip to main content

Crate zbq_sys

Crate zbq_sys 

Source
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_commit behaviour.
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_bytes previously written into the contiguous run returned by the most recent zbq_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.