Merge branch 'riscv-killed' into riscv

This commit is contained in:
Frans Kaashoek 2022-08-23 07:31:08 -04:00
commit cd6207a972
6 changed files with 29 additions and 8 deletions

View file

@ -424,7 +424,7 @@ wait(uint64 addr)
}
// No point waiting if we don't have any children.
if(!havekids || p->killed){
if(!havekids || killed(p)){
release(&wait_lock);
return -1;
}
@ -603,6 +603,25 @@ kill(int pid)
return -1;
}
void
setkilled(struct proc *p)
{
acquire(&p->lock);
p->killed = 1;
release(&p->lock);
}
int
killed(struct proc *p)
{
int k;
acquire(&p->lock);
k = p->killed;
release(&p->lock);
return k;
}
// Copy to either a user address, or kernel address,
// depending on usr_dst.
// Returns 0 on success, -1 on error.