1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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
pub use *;
pub use *;
pub use ProcessEventsConnector;