shmem_ipc/
lib.rs

1//! Communication between processes using shared memory.
2//!
3//! This crate uses memfd sealing to ensure safety between untrusted processes,
4//! and therefore, it works only on Linux.
5//!
6//! You might want to start in the `sharedring` module, which sets up a lock-free ringbuffer
7//! between untrusted processes. Another useful function is `mem::write_once` for a scenario where
8//! you write data once and make it available for reading afterwards. The `mem` and `ringbuf`
9//! contain building blocks that might be useful in other use cases.
10//!
11//! There is also a client/server example in the `examples` directory that can help you get started.
12//! Enjoy!
13
14pub mod mem;
15
16pub mod ringbuf;
17
18pub mod sharedring;
19
20/// Enumeration of errors possible in this library
21#[derive(thiserror::Error, Debug)]
22pub enum Error {
23    #[error("Memfd errors {0:?}")]
24    Memfd(#[from] mem::mfd::Error),
25    #[error("OS errors {0:?}")]
26    Io(#[from] std::io::Error),
27    #[error("Ringbuffer errors {0:?}")]
28    Ringbuf(#[from] ringbuf::Error),
29}