Struct procfs::Lock[][src]

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: 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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.