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::uid`] for ownership lookups
34//! - [`crate::spawn`] for explicit process spawning
35//! - [`crate::reactor`] for fd readiness primitives
36//! - [`crate::inotify`] for watch/decode helpers
37//! - [`crate::safe_fs`] for symlink-safe filesystem primitives
38//! - [`crate::unix_socket`] for Unix domain socket primitives
39//! - [`crate::io`] for explicit drain helpers
40//!
41//! ```compile_fail
42//! use coreshift_core::Daemon;
43//! ```
44//!
45//! ```compile_fail
46//! use coreshift_core::ForegroundResolver;
47//! ```
48
49pub mod android_property;
50pub mod dex;
51pub mod binder;
52pub mod drm;
53pub mod error;
54pub mod fs;
55pub mod inotify;
56pub mod io;
57pub mod log;
58pub mod netlink;
59pub mod proc;
60pub mod process;
61pub mod reactor;
62pub mod safe_fs;
63pub mod signal;
64pub mod spawn;
65pub mod uid;
66pub mod unix_socket;
67
68pub use error::CoreError;
69
70#[cfg(test)]
71mod tests;