lockf implementation proposal

This commit is contained in:
David Carlier
2023-05-16 23:40:40 +01:00
parent a768852bec
commit bae8bb68df
9 changed files with 58 additions and 18 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ fn dup_write<T>(fd: c_int, name: &str, t: &T) -> syscall::Result<usize> {
pub unsafe extern "C" fn ioctl(fd: c_int, request: c_ulong, out: *mut c_void) -> c_int {
match request {
FIONBIO => {
let mut flags = fcntl::sys_fcntl(fd, fcntl::F_GETFL, 0);
let mut flags = fcntl::sys_fcntl(fd, fcntl::F_GETFL, 0usize);
if flags < 0 {
return -1;
}
@@ -72,7 +72,7 @@ pub unsafe extern "C" fn ioctl(fd: c_int, request: c_ulong, out: *mut c_void) ->
} else {
flags | fcntl::O_NONBLOCK
};
if fcntl::sys_fcntl(fd, fcntl::F_SETFL, flags) < 0 {
if fcntl::sys_fcntl(fd, fcntl::F_SETFL, flags as c_ulonglong) < 0 {
-1
} else {
0