Every mapped Zinc region begins with a 64-byte header occupying one CPU cache line. The header isDocumentation Index
Fetch the complete documentation index at: https://mine-27913f41.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
#[repr(C, align(64))] in Rust, meaning its layout is stable and exactly 64 bytes. The data area begins at offset 64.
Layout
Fields
magic (offset 0, 8 bytes)
Fixed to0x5A494E435F524547, which spells "ZINC_REG" in ASCII. Checked on open to detect corrupted regions or segments that were overwritten by non-Zinc code. Any process could theoretically write a valid magic number at this offset; this field is a sanity check, not a security boundary.
version (offset 8, 2 bytes)
Currently 1. Incremented when the header layout changes in a backward-incompatible way. When a region is opened, the opener’s library version must match the stored version. A mismatch returnsCorruptedRegion.
flags (offset 10, 2 bytes)
Reserved for future use. Currently always 0. Writers should not depend on this field being zero, as future versions may use it for feature flags.notify_seq (offset 12, 4 bytes)
The atomic counter used bynotify() and wait(). Incremented on every notify() call. On Linux, the address of this field is passed as the futex word. On other platforms, it is polled in the adaptive wait loop.
capacity (offset 16, 8 bytes)
The number of usable bytes in the data area. Set at creation time and immutable for the lifetime of the region. This is the total mapping size minus 64 bytes.ref_count (offset 24, 4 bytes)
Tracks the number of open handles on this region. Incremented onzinc_open, decremented on zinc_close. When the creator’s handle closes and the count reaches zero, the region is unlinked.
owner_pid (offset 28, 4 bytes)
The PID of the process that calledcreate. Stored for diagnostic purposes. Not used by the library logic, but helpful when debugging leaked regions.
created_at (offset 32, 8 bytes)
Unix timestamp in nanoseconds at the time of creation. Set fromSystemTime::now().duration_since(UNIX_EPOCH). Useful for ordering or deduplication of regions with the same name.
name_hash (offset 40, 8 bytes)
FNV-1a hash of the region name. Stored to allow quick equality checks without string comparison across processes. Not used by the current implementation but reserved for future use.ring_head / ring_tail (offset 48 / 56, 8 bytes each)
The head and tail cursors of the internal lock-free notification ring. This ring is used for lightweight event delivery (sequence numbers, not data). The ring has 256 slots and uses a standard MPSC (multi-producer, single-consumer) protocol on these atomic counters.Stability guarantees
The header layout is versioned. Version 1 will never change. If a future version needs to add fields, it can reuse the reservedflags field or extend into the data area with a new version number. The magic and version fields are always at offset 0 and 8 for forward compatibility.
