Use implicitly passed _caller_pid in syscalls
This commit is contained in:
@ -20,7 +20,7 @@ int32_t SYSCALL1(sys_proc_kill, pid1) {
|
||||
int32_t ret = E_OK;
|
||||
|
||||
if (pid == (uint64_t)-1) {
|
||||
pid = PROCS.current->pid;
|
||||
pid = _caller_pid;
|
||||
}
|
||||
|
||||
spinlock_acquire(&PROCS.spinlock);
|
||||
@ -38,7 +38,8 @@ int32_t SYSCALL3(sys_proc_spawn, opath1, args1, argslen1) {
|
||||
int32_t ret = E_OK;
|
||||
|
||||
spinlock_acquire(&PROCS.spinlock);
|
||||
Proc *proc = PROCS.current;
|
||||
Proc *proc = NULL;
|
||||
LL_FINDPROP(PROCS.procs, proc, pid, _caller_pid);
|
||||
spinlock_release(&PROCS.spinlock);
|
||||
|
||||
const char *opath = (const char *)opath1;
|
||||
@ -87,7 +88,7 @@ int32_t SYSCALL1(sys_proc_pollstate, pid1) {
|
||||
int32_t ret = E_OK;
|
||||
|
||||
if (pid == (uint64_t)-1) {
|
||||
pid = PROCS.current->pid;
|
||||
pid = _caller_pid;
|
||||
}
|
||||
|
||||
spinlock_acquire(&PROCS.spinlock);
|
||||
@ -107,15 +108,7 @@ done:
|
||||
}
|
||||
|
||||
int32_t SYSCALL0(sys_proc_getpid) {
|
||||
int32_t ret = E_OK;
|
||||
|
||||
spinlock_acquire(&PROCS.spinlock);
|
||||
Proc *proc = PROCS.current;
|
||||
spinlock_release(&PROCS.spinlock);
|
||||
|
||||
ret = proc->pid;
|
||||
|
||||
return ret;
|
||||
return _caller_pid;
|
||||
}
|
||||
|
||||
int32_t SYSCALL1(sys_proc_run, pid1) {
|
||||
@ -143,7 +136,7 @@ int32_t SYSCALL1(sys_proc_arglen, pid1) {
|
||||
int32_t ret = E_OK;
|
||||
|
||||
if (pid == (uint64_t)-1) {
|
||||
pid = PROCS.current->pid;
|
||||
pid = _caller_pid;
|
||||
}
|
||||
|
||||
spinlock_acquire(&PROCS.spinlock);
|
||||
@ -160,7 +153,7 @@ int32_t SYSCALL4(sys_proc_argv, pid1, argslen1, argbuf1, maxargs1) {
|
||||
int32_t ret = E_OK;
|
||||
|
||||
if (pid == (uint64_t)-1) {
|
||||
pid = PROCS.current->pid;
|
||||
pid = _caller_pid;
|
||||
}
|
||||
|
||||
spinlock_acquire(&PROCS.spinlock);
|
||||
|
||||
Reference in New Issue
Block a user