Refactor semaphore to support atomic semop

This commit is contained in:
Yuke Peng
2024-09-02 12:57:49 +08:00
committed by Tate, Hongliang Tian
parent 9a2faff07b
commit 6ce50fab1c
4 changed files with 417 additions and 272 deletions

View File

@ -58,10 +58,12 @@ fn do_sys_semtimedop(
}
let user_space = ctx.get_user_space();
let mut semops = Vec::with_capacity(nsops);
for i in 0..nsops {
let sem_buf = user_space.read_val::<SemBuf>(tsops + size_of::<SemBuf>() * i)?;
sem_op(sem_id, &sem_buf, timeout, ctx)?;
semops.push(user_space.read_val::<SemBuf>(tsops + size_of::<SemBuf>() * i)?);
}
sem_op(sem_id, semops, timeout, ctx)?;
Ok(SyscallReturn::Return(0))
}