procctl(2): add consistent shortcut P_ID:0 as curproc
(cherry picked from commit f833ab9dd1
)
This commit is contained in:
parent
19eec36599
commit
2e69ba48b9
@ -62,6 +62,8 @@ The following identifier types are supported:
|
||||
.It Dv P_PID
|
||||
Control the process with the process ID
|
||||
.Fa id .
|
||||
.Fa id
|
||||
zero is a shortcut for the calling process ID.
|
||||
.It Dv P_PGID
|
||||
Control processes belonging to the process group with the ID
|
||||
.Fa id .
|
||||
|
@ -904,12 +904,18 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data)
|
||||
|
||||
switch (idtype) {
|
||||
case P_PID:
|
||||
p = pfind(id);
|
||||
if (p == NULL) {
|
||||
error = ESRCH;
|
||||
break;
|
||||
if (id == 0) {
|
||||
p = td->td_proc;
|
||||
error = 0;
|
||||
PROC_LOCK(p);
|
||||
} else {
|
||||
p = pfind(id);
|
||||
if (p == NULL) {
|
||||
error = ESRCH;
|
||||
break;
|
||||
}
|
||||
error = p_cansee(td, p);
|
||||
}
|
||||
error = p_cansee(td, p);
|
||||
if (error == 0)
|
||||
error = kern_procctl_single(td, p, com, data);
|
||||
PROC_UNLOCK(p);
|
||||
|
Loading…
Reference in New Issue
Block a user