aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 269705205fbc..ae80ba9ed5ed 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -2088,12 +2088,16 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS)
if (namelen != 1)
return (EINVAL);
+ p = curproc;
pid = (pid_t)name[0];
+ if (pid == -1) {
+ pid = p->p_pid;
+ }
+
/*
* If the query is for this process and it is single-threaded, there
* is nobody to modify pargs, thus we can just read.
*/
- p = curproc;
if (pid == p->p_pid && p->p_numthreads == 1 && req->newptr == NULL &&
(pa = p->p_args) != NULL)
return (SYSCTL_OUT(req, pa->ar_args, pa->ar_length));