pub fn is_root() -> bool {
#[cfg(unix)]
{
unsafe {
extern "C" {
fn geteuid() -> u32;
}
geteuid() == 0
}
}
#[cfg(target_os = "windows")]
{
false
}
}
pub fn has_non_root_capability() -> bool {
#[cfg(target_os = "linux")]
{
true
}
#[cfg(target_os = "macos")]
{
true
}
#[cfg(target_os = "windows")]
{
true
}
#[cfg(any(target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))]
{
false
}
#[cfg(not(any(
target_os = "linux",
target_os = "macos",
target_os = "windows",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd"
)))]
{
false
}
}