fix bug: sys_futex should not check timeout parameter for musl libc 1.1.22

master
chyyuu 6 years ago
parent 252449a198
commit d9d21a3db1

@ -59,15 +59,16 @@ impl Syscall<'_> {
uaddr: usize,
op: u32,
val: i32,
timeout: *const TimeSpec,
// timeout: *const TimeSpec,
) -> SysResult {
info!(
"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}, timeout_ptr: {:?}",
//"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}, timeout_ptr: {:?}",
"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}. timeout ALWAYS 0",
thread::current().id(),
uaddr,
op,
val,
timeout
val
// timeout
);
// if op & OP_PRIVATE == 0 {
// unimplemented!("futex only support process-private");
@ -77,11 +78,13 @@ impl Syscall<'_> {
return Err(SysError::EINVAL);
}
let atomic = unsafe { self.vm().check_write_ptr(uaddr as *mut AtomicI32)? };
let _timeout = if timeout.is_null() {
None
} else {
Some(unsafe { *self.vm().check_read_ptr(timeout)? })
};
// musl libc 1.1.22 _wake FUN didn't provide timeout, ___futexwait FUN set timeout=0
// now rcore just ignored the timeout parameter. TODO
// let _timeout = if timeout.is_null() {
// None
// } else {
// Some(unsafe { *self.vm().check_read_ptr(timeout)? })
// };
const OP_WAIT: u32 = 0;
const OP_WAKE: u32 = 1;

@ -229,7 +229,7 @@ impl Syscall<'_> {
args[0],
args[1] as u32,
args[2] as i32,
args[3] as *const TimeSpec,
// args[3] as *const TimeSpec,
),
// time

Loading…
Cancel
Save