MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / get_flock

Function get_flock

block/src/fcntl.rs:176–184  ·  view source on GitHub ↗

Returns a [`struct@libc::flock`] structure for the whole file.

(lock_type: LockType, granularity: LockGranularity)

Source from the content-addressed store, hash-verified

174
175/// Returns a [`struct@libc::flock`] structure for the whole file.
176const fn get_flock(lock_type: LockType, granularity: LockGranularity) -> libc::flock {
177 libc::flock {
178 l_type: lock_type.to_libc_val() as libc::c_short,
179 l_whence: libc::SEEK_SET as libc::c_short,
180 l_start: granularity.l_start() as libc::c_long,
181 l_len: granularity.l_len() as libc::c_long,
182 l_pid: 0, /* filled by callee */
183 }
184}
185
186/// Tries to acquire a lock using [`fcntl`] with respect to the given
187/// parameters.

Callers 2

try_acquire_lockFunction · 0.85
get_lock_stateFunction · 0.85

Calls 3

to_libc_valMethod · 0.80
l_startMethod · 0.80
l_lenMethod · 0.80

Tested by

no test coverage detected