mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-19 04:26:39 +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 mut val = self.val.lock();
|
||||||
let sem_op = sem_buf.sem_op;
|
let sem_op = sem_buf.sem_op;
|
||||||
let current_pid = ctx.process.pid();
|
let current_pid = ctx.process.pid();
|
||||||
@ -208,7 +208,7 @@ impl Semaphore {
|
|||||||
let (waiter, waker) = Waiter::new_pair();
|
let (waiter, waker) = Waiter::new_pair();
|
||||||
let status = Arc::new(AtomicStatus::new(Status::Pending));
|
let status = Arc::new(AtomicStatus::new(Status::Pending));
|
||||||
let pending_op = Box::new(PendingOp {
|
let pending_op = Box::new(PendingOp {
|
||||||
sem_buf,
|
sem_buf: *sem_buf,
|
||||||
status: status.clone(),
|
status: status.clone(),
|
||||||
waker: waker.clone(),
|
waker: waker.clone(),
|
||||||
process: ctx.posix_thread.weak_process(),
|
process: ctx.posix_thread.weak_process(),
|
||||||
@ -303,7 +303,7 @@ impl Semaphore {
|
|||||||
|
|
||||||
pub fn sem_op(
|
pub fn sem_op(
|
||||||
sem_id: key_t,
|
sem_id: key_t,
|
||||||
sem_buf: SemBuf,
|
sem_buf: &SemBuf,
|
||||||
timeout: Option<Duration>,
|
timeout: Option<Duration>,
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
@ -61,7 +61,7 @@ fn do_sys_semtimedop(
|
|||||||
let sem_buf =
|
let sem_buf =
|
||||||
CurrentUserSpace::get().read_val::<SemBuf>(tsops + size_of::<SemBuf>() * i)?;
|
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))
|
Ok(SyscallReturn::Return(0))
|
||||||
|
Reference in New Issue
Block a user