use std::io;
pub fn get_parent_pid() -> io::Result<u32> {
let ppid = unsafe { libc::getppid() };
if ppid < 0 {
Err(io::Error::last_os_error())
} else {
Ok(ppid.try_into().unwrap())
}
}
pub fn get_user_id() -> io::Result<u32> {
let uid = unsafe { libc::getuid() };
Ok(uid)
}
#[must_use]
pub fn is_tty(fd: i32) -> bool {
unsafe { libc::isatty(fd) == 1 }
}