Struct procfs_core::Lock
source · 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
.