rustix::fs

Function fcntl_lock

Source
pub fn fcntl_lock<Fd: AsFd>(fd: Fd, operation: FlockOperation) -> Result<()>
Available on crate feature fs only.
Expand description

fcntl(fd, F_SETLK)—Acquire or release an fcntl-style lock.

This function doesn’t currently have an offset or len; it currently always sets the l_len field to 0, which is a special case that means the entire file should be locked.

Unlike flock-style locks, fcntl-style locks are process-associated, meaning that they don’t guard against being acquired by two threads in the same process.

§References