Expand description
Wrapper around fcntl (2) and convenience methods to make interacting with it easier. Currently only supports commands related to Advisory record locking.
Structs§
Enums§
- Allowed types for the
arg
parameter for thefcntl
syscall. - Allowed commands (
cmd
parameter) for thefcntl
syscall. - Error type which functions of this crate will return.
- Defines which types of lock can be set onto files.
Traits§
- This trait is used to define functions wich directly operate on
flock
.
Functions§
- Calls
fcntl
with the givencmd
andarg
. On success, the structure passed to thearg
parameter is returned as returned by the kernel. Note: Where possible convenience wrappers (such asis_file_locked
,lock_file
, etc.) should be used as they correctly interpret possible return values of the syscall. - Checks whether the given file is locked.
- Locks the given file (using
FcntlCmd::SetLock
). Ifflock
isNone
all parameters of the flock structure (l_whence
,l_start
,l_len
,l_pid
) will be set to 0.locktype
controls thel_type
parameter. When it isNone
,FcntlLockType::Read
is used.flock.l_type
will be overwritten in all cases to avoid passing an invalid parameter to the syscall. - Releases the lock on the given file (using
FcntlCmd::SetLock
). Ifflock
isNone
all parameters of the flock structure (l_whence
,l_start
,l_len
,l_pid
) will be set to 0.flock.l_type
will be set tolibc::F_UNLCK
regardless of its original value.