Merge branch 'sysfile-doc' into 'master'
document some constants in sys_file See merge request redox-os/relibc!1379
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 <https://man7.org/linux/man-pages/man2/flock.2.html>.
|
||||
///
|
||||
/// 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()
|
||||
|
||||
Reference in New Issue
Block a user