cypat/util/mod.rs
1/*
2* SPDX-License-Identifier: GPL-3.0-only
3* A cyberpatriots scoring engine library
4* Copyright (C) 2023 Teresa Maria Rivera
5*/
6
7//! # Utility functions and data structures
8
9mod user;
10mod program;
11mod filesystem;
12pub use user::*;
13pub use program::*;
14pub use filesystem::*;
15
16#[cfg(target_os = "linux")]
17pub use libc::{uid_t, gid_t};
18
19/// Get the OS error, effectively the same as the errno macro in C
20pub fn errno() -> i32 {
21 std::io::Error::last_os_error().raw_os_error().unwrap_or(0)
22}