Wrapper for [`libc::fcntl`] that properly sets the function arguments.
(fd: RawFd, arg: FcntlArg)
| 44 | |
| 45 | /// Wrapper for [`libc::fcntl`] that properly sets the function arguments. |
| 46 | fn fcntl(fd: RawFd, arg: FcntlArg) -> libc::c_int { |
| 47 | // SAFETY: We use a valid FD. |
| 48 | unsafe { |
| 49 | match arg { |
| 50 | FcntlArg::F_OFD_SETLK(flock) => libc::fcntl(fd, libc::F_OFD_SETLK, flock), |
| 51 | FcntlArg::F_OFD_GETLK(flock) => libc::fcntl(fd, libc::F_OFD_GETLK, flock), |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | /// Describes the type of lock you want to set. |
| 57 | #[derive(Clone, Copy, Debug)] |
no outgoing calls