pub struct Lock {
pub lock_type: LockType,
pub mode: LockMode,
pub kind: LockKind,
pub pid: Option<i32>,
pub devmaj: u32,
pub devmin: u32,
pub inode: u64,
pub offset_first: u64,
pub offset_last: Option<u64>,
}Expand description
Details about an individual file lock
See the locks function.
For an example, see the lslocks.rs example in the source repo.
Fields
lock_type: LockTypeThe type of lock
mode: LockModeThe lock mode (advisory or mandatory)
kind: LockKindThe kind of lock (read or write)
pid: Option<i32>The process that owns the lock
Because OFD locks are not owned by a single process (since multiple processes
may have file descriptors that refer to the same FD), this field may be None.
Before kernel 4.14 a bug meant that the PID of of the process that initially
acquired the lock was displayed instead of None.
devmaj: u32The major ID of the device containing the FS that contains this lock
devmin: u32The minor ID of the device containing the FS that contains this lock
inode: u64The inode of the locked file
offset_first: u64The offset (in bytes) of the first byte of the lock.
For BSD locks, this value is always 0.
offset_last: Option<u64>The offset (in bytes) of the last byte of the lock.
None means the lock extends to the end of the file. For BSD locks,
the value is always None.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Lock
impl Send for Lock
impl Sync for Lock
impl Unpin for Lock
impl UnwindSafe for Lock
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more