use thiserror::Error;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "linux")]
pub use crate::linux::*;
#[cfg(not(target_os = "linux"))]
mod default;
#[cfg(not(target_os = "linux"))]
pub use crate::default::*;
#[derive(Debug, Error)]
pub enum Error {
#[error("Unsupported OS. Could not get process limits.")]
UnsupportedOS,
#[error("Proc file not found at `{}`: {}", .0, .1)]
ProcFileNotFound(String, #[source] std::io::Error),
}
pub fn get_own_limits() -> Result<Limits, crate::Error> {
let own_pid = std::process::id();
get_pid_limits(own_pid)
}