Crate fcntl

Source
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 the fcntl syscall.
  • Allowed commands (cmd parameter) for the fcntl 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 given cmd and arg. On success, the structure passed to the arg parameter is returned as returned by the kernel. Note: Where possible convenience wrappers (such as is_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). If flock is None all parameters of the flock structure ( l_whence, l_start, l_len, l_pid) will be set to 0. locktype controls the l_type parameter. When it is None, 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). If flock is None 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 to libc::F_UNLCK regardless of its original value.

Type Aliases§