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::binder`] for NDK binder service queries (Android only)
29//! - [`crate::drm`] for DRM card vblank wait primitives
30//! - [`crate::fs`] for filesystem probes and readahead
31//! - [`crate::proc`] for procfs helpers
32//! - [`crate::signal`] for signal and shutdown helpers
33//! - [`crate::spawn`] for explicit process spawning
34//! - [`crate::reactor`] for fd readiness primitives
35//! - [`crate::inotify`] for watch/decode helpers
36//! - [`crate::socket`] for Unix domain socket primitives
37//! - [`crate::io`] for explicit drain helpers
38//! - [`crate::transport`] for the command/watcher transport seam
39//!
40//! ```compile_fail
41//! use coreshift_core::Daemon;
42//! ```
43//!
44//! ```compile_fail
45//! use coreshift_core::ForegroundResolver;
46//! ```
47
48pub mod android;
49pub mod binder;
50pub mod drm;
51pub mod error;
52pub mod fd;
53pub mod fs;
54pub mod inotify;
55pub mod io;
56pub mod log;
57pub mod proc;
58pub mod process;
59pub mod reactor;
60pub mod signal;
61pub mod socket;
62pub mod spawn;
63pub mod transport;
64pub mod uevent;
65
66pub use error::CoreError;
67
68#[cfg(test)]
69mod tests;