Files
RedBear-OS/src/header/sys_file/mod.rs
T
Peter Limkilde Svendsen 5591eeacb3 Add docs for sys/file.h
2024-11-20 23:21:48 +01:00

24 lines
598 B
Rust

//! `sys/file.h` implementation.
//!
//! Non-POSIX, see <https://man7.org/linux/man-pages/man2/flock.2.html>.
use crate::{
error::ResultExt,
platform::{types::*, Pal, Sys},
};
pub const LOCK_SH: usize = 1;
pub const LOCK_EX: usize = 2;
pub const LOCK_NB: usize = 4;
pub const LOCK_UN: usize = 8;
pub const L_SET: usize = 0;
pub const L_INCR: usize = 1;
pub const L_XTND: usize = 2;
/// See <https://man7.org/linux/man-pages/man2/flock.2.html>.
#[no_mangle]
pub extern "C" fn flock(fd: c_int, operation: c_int) -> c_int {
Sys::flock(fd, operation).map(|()| 0).or_minus_one_errno()
}