Returns a [`struct@libc::flock`] structure for the whole file.
(lock_type: LockType, granularity: LockGranularity)
| 174 | |
| 175 | /// Returns a [`struct@libc::flock`] structure for the whole file. |
| 176 | const 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. |
no test coverage detected