Skip to main content

coreshift_core/
lib.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/
4
5//! CoreShift Core is the low-level Linux and Android foundation crate for the
6//! CoreShift ecosystem.
7//!
8//! CoreShift Core keeps direct kernel, `libc`, and procfs interaction in one
9//! place so higher layers can stay policy-oriented:
10//! - **CoreShift Core**: low-level Linux and Android primitives
11//! - **CoreShift Engine**: daemon and plugin runtime
12//! - **CoreShift Policy**: policy logic and product behavior
13//!
14//! This crate is intentionally policy-neutral. It provides mechanisms such as
15//! spawning, `epoll`, `inotify`, procfs inspection, and signal helpers. It
16//! does not make daemon lifecycle or product decisions for callers.
17//!
18//! ### Core Guarantees
19//!
20//! Core adheres to strict architectural invariants to ensure stability:
21//! - **No policy**: Primitives only; no allowlists, retry plans, or fallbacks.
22//! - **No hidden threads**: Work is performed on the caller's thread.
23//! - **No global state**: Stateless execution; no global mutable configuration.
24//! - **No scheduler**: Provides reactor primitives but does not own execution.
25//!
26//! Public primitive modules:
27//! - [`crate::android_property`] for direct Android system property access
28//! - [`crate::fs`] for filesystem probes and readahead
29//! - [`crate::proc`] for procfs helpers
30//! - [`crate::signal`] for signal and shutdown helpers
31//! - [`crate::uid`] for ownership lookups
32//! - [`crate::spawn`] for explicit process spawning
33//! - [`crate::reactor`] for fd readiness primitives
34//! - [`crate::inotify`] for watch/decode helpers
35//! - [`crate::unix_socket`] for Unix domain socket primitives
36//! - [`crate::io`] for explicit drain helpers
37//!
38//! ```compile_fail
39//! use coreshift_core::Daemon;
40//! ```
41//!
42//! ```compile_fail
43//! use coreshift_core::ForegroundResolver;
44//! ```
45
46pub mod android_property;
47pub mod error;
48pub mod fs;
49pub mod inotify;
50pub mod io;
51pub mod log;
52pub mod proc;
53pub mod reactor;
54pub mod signal;
55pub mod spawn;
56pub mod uid;
57pub mod unix_socket;
58
59pub use error::CoreError;
60
61#[cfg(test)]
62mod tests;