diff --git a/src/header/sys_file/cbindgen.toml b/src/header/sys_file/cbindgen.toml index d5d26dfa5b..fc55c712ad 100644 --- a/src/header/sys_file/cbindgen.toml +++ b/src/header/sys_file/cbindgen.toml @@ -1,6 +1,5 @@ -include_guard = "_SYS_FILE_H" +include_guard = "_RELIBC_SYS_FILE_H" language = "C" -style = "Tag" no_includes = true cpp_compat = true diff --git a/src/header/sys_file/mod.rs b/src/header/sys_file/mod.rs index 810540213d..b095e8d5fc 100644 --- a/src/header/sys_file/mod.rs +++ b/src/header/sys_file/mod.rs @@ -7,9 +7,14 @@ use crate::{ platform::{Pal, Sys, types::c_int}, }; +/// Place a shared lock. pub const LOCK_SH: c_int = 1; +/// Place an exclusive lock. pub const LOCK_EX: c_int = 2; +/// To make a nonblocking request, include `LOCK_NB` (by ORing) with any of +/// `LOCK_SH`, `LOCK_EX` and `LOCK_UN`. pub const LOCK_NB: c_int = 4; +/// Remove an existing lock held by this process. pub const LOCK_UN: c_int = 8; pub const L_SET: c_int = 0; @@ -17,6 +22,8 @@ pub const L_INCR: c_int = 1; pub const L_XTND: c_int = 2; /// See . +/// +/// Apply or remove an advisory lock on an open file. #[unsafe(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()