Date: Sat, 16 Jan 2021 11:31:19 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Mateusz Guzik <mjg@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fe258f23ef36 - main - Save on getpid in setproctitle by supporting -1 as curproc. Message-ID: <YAKyZxYZ8GjHZP3%2B@kib.kiev.ua> In-Reply-To: <202101160838.10G8ci4b031607@gitrepo.freebsd.org> References: <202101160838.10G8ci4b031607@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 16, 2021 at 08:38:44AM +0000, Mateusz Guzik wrote: > 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 ever done, this should be done in pget(), to provide consistent interface for all kern.proc nodes.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YAKyZxYZ8GjHZP3%2B>