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
For an example, see the lslocks.rs example in the source repo.
Fields§
§lock_type: LockType
The type of lock
mode: LockMode
The lock mode (advisory or mandatory)
kind: LockKind
The 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: u32
The major ID of the device containing the FS that contains this lock
devmin: u32
The minor ID of the device containing the FS that contains this lock
inode: u64
The inode of the locked file
offset_first: u64
The 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§
source§impl<'de> Deserialize<'de> for Lock
impl<'de> Deserialize<'de> for Lock
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Lock
impl RefUnwindSafe for Lock
impl Send for Lock
impl Sync for Lock
impl Unpin for Lock
impl UnwindSafe for Lock
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)