Skip to content

Commit

Permalink
Removed polyfill implementation and updated struct and constants requ…
Browse files Browse the repository at this point in the history
…ired
  • Loading branch information
Jesse Hoogervorst committed Nov 16, 2024
1 parent 7aeabc9 commit 393cba1
Showing 1 changed file with 7 additions and 40 deletions.
47 changes: 7 additions & 40 deletions src/vxworks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,13 @@ s! {
pub mq_curmsgs: ::c_long,
}

pub struct FLock {
l_type: ::c_short,
l_whence: ::c_short,
l_start: ::c_long,
l_len: ::c_long,
l_pid: ::c_short,
l_xxx: ::c_short,
pub struct flock {
pub l_type: ::c_short,
pub l_whence: ::c_short,
pub l_start: ::c_long,
pub l_len: ::c_long,
pub l_pid: ::c_short,
pub l_xxx: ::c_short,
}
}

Expand Down Expand Up @@ -955,10 +955,6 @@ pub const F_DUPFD_CLOEXEC: ::c_int = 14;
pub const F_RDLCK: ::c_int = 1;
pub const F_WRLCK: ::c_int = 2;
pub const F_UNLCK: ::c_int = 3;
pub const LOCK_SH: ::c_int = 1;
pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;

// signal.h
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
Expand Down Expand Up @@ -2029,35 +2025,6 @@ pub unsafe fn posix_memalign(
}
}

pub unsafe fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int {
let lock_type = match operation & !LOCK_NB {
LOCK_SH => F_RDLCK,
LOCK_EX => F_WRLCK,
LOCK_UN => F_UNLCK,
_ => {
errnoSet(EINVAL);
return ERROR;
}
};

let request = if operation & LOCK_NB != 0 {
F_SETLK
} else {
F_SETLKW
};

let mut argument = FLock {
l_type: lock_type as i16,
l_whence: SEEK_SET as i16,
l_start: 0,
l_len: 0,
l_pid: 0,
l_xxx: 0,
};

return ioctl(fd, request, core::ptr::addr_of_mut!(argument));
}

pub use ffi::c_void;

cfg_if! {
Expand Down

0 comments on commit 393cba1

Please sign in to comment.