|
5 | 5 | //! |
6 | 6 | //! Not all methods are available on both Operating Systems yet, but more will be made |
7 | 7 | //! cross-platform over time. |
| 8 | +//! |
| 9 | +//! Get information (such as name, path, process info, fd) about running processes by pid, process type, etc. |
| 10 | +//! |
| 11 | +//! At the moment these methods have been implemented, most of which have examples in their docs: |
| 12 | +//! |
8 | 13 |
|
9 | | -extern crate errno; |
10 | | -extern crate libc; |
11 | | - |
12 | | -/// Get information (such as name, path, process info, fd) about running processes by pid, process type, etc. |
13 | | -/// At the moment these methods have been implemented, most of which have examples in their docs: |
14 | | -/// |
15 | | -/// # `libproc::libproc` (names that way for bad, historical reasons!) |
16 | | -/// ## Process / PID related |
17 | | -/// `pub fn listpids(proc_types: ProcType) -> Result<Vec<u32>, String> (macos) (linux)` |
18 | | -/// |
19 | | -/// `pub fn listpidspath(proc_types: ProcType, path: &str) -> Result<Vec<u32>, String> (macos) (linux)` |
20 | | -/// |
21 | | -/// `pub fn pidinfo<T: PIDInfo>(pid : i32, arg: u64) -> Result<T, String> (macos)` |
22 | | -/// |
23 | | -/// `pub fn regionfilename(pid: i32, address: u64) -> Result<String, String> (macos)` |
24 | | -/// |
25 | | -/// `pub fn pidpath(pid : i32) -> Result<String, String> (macos) (linux)` |
26 | | -/// |
27 | | -/// `pub fn libversion() -> Result<(i32, i32), String> (macos)` |
28 | | -/// |
29 | | -/// `pub fn name(pid: i32) -> Result<String, String> (linux) (macos)` |
30 | | -/// |
31 | | -/// `pub fn listpidinfo<T: ListPIDInfo>(pid : i32, max_len: usize) -> Result<Vec<T::Item>, String> (macos)` |
32 | | -/// |
33 | | -/// `pub fn pidcwd(pid: pid_t) -> Result<PathBuf, String> (linux)` |
34 | | -/// |
35 | | -/// `pub fn cwdself() -> Result<PathBuf, String> (linux)` |
36 | | -/// |
37 | | -/// ## File and FileDescriptor related |
38 | | -/// `pub fn pidfdinfo<T: PIDFDInfo>(pid : i32, fd: i32) -> Result<T, String> (macos)` |
39 | | -/// |
40 | | -/// ## PID Resource Usage related |
41 | | -/// (Added in Mac OS X 10.9 - under "macosx_10_9" feature) |
42 | | -/// `pub fn pidrusage<T: PIDRUsage>(pid : i32) -> Result<T, String> (macos)` |
43 | | -/// |
44 | | -/// ## Kernel Message Buffer - kmsgbuf |
45 | | -/// `pub fn kmsgbuf() -> Result<String, String>` |
46 | | -pub mod libproc; |
47 | 14 | /// List processes by type, path or by type and path. |
48 | | -/// |
49 | | -/// `pub fn pids_by_type(filter: ProcFilter)` (macos) (linux) |
50 | | -/// |
51 | | -/// `pub fn pids_by_path(path: &Path, is_volume: bool, exclude_event_only: bool)` (macos) |
52 | | -/// |
53 | | -/// `pub fn pids_by_type_and_path(filter: ProcFilter, path: &Path, is_volume: bool, exclude_event_only: bool)` (macos) |
54 | 15 | pub mod processes; |
55 | 16 |
|
| 17 | +#[doc(inline)] |
| 18 | +/// Get information about processes using mainly the `pid` |
| 19 | +pub use libproc::proc_pid; |
| 20 | + |
| 21 | +#[doc(inline)] |
| 22 | +/// Read messages from the Kernel Message Buffer |
| 23 | +pub use libproc::kmesg_buffer; |
| 24 | + |
| 25 | +#[doc(inline)] |
| 26 | +/// Get information about resource usage of processes |
| 27 | +pub use libproc::pid_rusage; |
| 28 | + |
| 29 | +#[cfg(any(target_os = "macos", doc))] |
| 30 | +#[doc(inline)] |
| 31 | +/// Get information specific to BSD/Darwin on macos |
| 32 | +pub use libproc::bsd_info; |
| 33 | + |
| 34 | +#[cfg(any(target_os = "macos", doc))] |
| 35 | +#[doc(inline)] |
| 36 | +/// Get information about a process's use of different types of file descriptors |
| 37 | +pub use libproc::file_info; |
| 38 | + |
| 39 | +#[cfg(any(target_os = "macos", doc))] |
| 40 | +#[doc(inline)] |
| 41 | +/// Get information about a processes use of network, sockets etc. |
| 42 | +pub use libproc::net_info; |
| 43 | + |
| 44 | +#[cfg(any(target_os = "macos", doc))] |
| 45 | +#[doc(inline)] |
| 46 | +/// Get information about a process's BSD Tasks |
| 47 | +pub use libproc::task_info; |
| 48 | + |
| 49 | +#[cfg(any(target_os = "macos", doc))] |
| 50 | +#[doc(inline)] |
| 51 | +/// Get information about threads within a process |
| 52 | +pub use libproc::thread_info; |
| 53 | + |
| 54 | +#[cfg(any(target_os = "macos", doc))] |
| 55 | +#[doc(inline)] |
| 56 | +/// Get information about Work Queues |
| 57 | +pub use libproc::work_queue_info; |
| 58 | + |
| 59 | +// Not documenting this as this export is legacy, and replaced by all the re-exports of |
| 60 | +// sub-modules above |
| 61 | +#[doc(hidden)] |
| 62 | +pub mod libproc; |
| 63 | + |
56 | 64 | #[cfg(target_os = "macos")] |
57 | 65 | #[allow(warnings, missing_docs)] |
58 | 66 | mod osx_libproc_bindings { |
|
0 commit comments