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