libcopes 1.0.0

A library for efficiently monitoring process exec and exit events on Linux
Documentation
// SPDX-License-Identifier: MPL-2.0
// Copyright 2025 Juan Palacios <jpalaciosdev@gmail.com>

//! # libcopes
//!
//! libcopes is a library for monitoring `exec` and `exit` process events
//! efficiently by using the Linux [process events connector] kernel interface.
//! It also provides functionality to read some information from a process and
//! to determine the executable file that started the process itself.
//!
//! # Example
//! Basic usage:
//! ```no_run
//! use libcopes::{
//!    PEvent, ProcessEventsConnector, get_process_executed_file,
//!    io::{cmdline_reader, exe_reader},
//! };
//!
//! let connector = ProcessEventsConnector::try_new()?;
//! let mut events = connector.into_iter();
//! loop {
//!     if let Some(event) = events.next() {
//!         if let Ok(process_event) = event {
//!             match process_event {
//!                 PEvent::Exec(pid) => {
//!                     let cmdline = cmdline_reader(pid)?;
//!                     let exe = get_process_executed_file(exe_reader(pid)?, &cmdline);
//!                     println!("Exec: PID {}, file: '{}', cmdline: {}", pid, exe, cmdline)
//!                 }
//!                 PEvent::Exit(pid) => println!("Exit: PID {}", pid),
//!             }
//!         }
//!     }
//! }
//! # Ok::<(), std::io::Error>(())
//! ```
//!
//! [process events connector]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9f46080

mod core;
mod exe_solver;
pub mod io;

#[doc(inline)]
pub use self::core::*;

#[doc(inline)]
pub use self::exe_solver::*;

#[doc(inline)]
pub use self::io::ProcessEventsConnector;