mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 12:06:43 +00:00
Pass the reference of sem_buf to semop
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
83a4366a72
commit
547e6430ee
@ -166,7 +166,7 @@ impl Semaphore {
|
||||
);
|
||||
}
|
||||
|
||||
fn sem_op(&self, sem_buf: SemBuf, timeout: Option<Duration>, ctx: &Context) -> Result<()> {
|
||||
fn sem_op(&self, sem_buf: &SemBuf, timeout: Option<Duration>, ctx: &Context) -> Result<()> {
|
||||
let mut val = self.val.lock();
|
||||
let sem_op = sem_buf.sem_op;
|
||||
let current_pid = ctx.process.pid();
|
||||
@ -208,7 +208,7 @@ impl Semaphore {
|
||||
let (waiter, waker) = Waiter::new_pair();
|
||||
let status = Arc::new(AtomicStatus::new(Status::Pending));
|
||||
let pending_op = Box::new(PendingOp {
|
||||
sem_buf,
|
||||
sem_buf: *sem_buf,
|
||||
status: status.clone(),
|
||||
waker: waker.clone(),
|
||||
process: ctx.posix_thread.weak_process(),
|
||||
@ -303,7 +303,7 @@ impl Semaphore {
|
||||
|
||||
pub fn sem_op(
|
||||
sem_id: key_t,
|
||||
sem_buf: SemBuf,
|
||||
sem_buf: &SemBuf,
|
||||
timeout: Option<Duration>,
|
||||
ctx: &Context,
|
||||
) -> Result<()> {
|
||||
|
@ -61,7 +61,7 @@ fn do_sys_semtimedop(
|
||||
let sem_buf =
|
||||
CurrentUserSpace::get().read_val::<SemBuf>(tsops + size_of::<SemBuf>() * i)?;
|
||||
|
||||
sem_op(sem_id, sem_buf, timeout, ctx)?;
|
||||
sem_op(sem_id, &sem_buf, timeout, ctx)?;
|
||||
}
|
||||
|
||||
Ok(SyscallReturn::Return(0))
|
||||
|
Reference in New Issue
Block a user