Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Nov 2017 23:32:44 -0500
From:      Mark Johnston <markj@FreeBSD.org>
To:        Mateusz Guzik <mjg@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r325721 - in head/sys: kern sys
Message-ID:  <20171112043244.GA1266@bish>
In-Reply-To: <201711111804.vABI4e6H038060@repo.freebsd.org>
References:  <201711111804.vABI4e6H038060@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 11, 2017 at 06:04:40PM +0000, Mateusz Guzik wrote:
> Author: mjg
> Date: Sat Nov 11 18:04:39 2017
> New Revision: 325721
> URL: https://svnweb.freebsd.org/changeset/base/325721
> 
> Log:
>   Add pfind_any
>   
>   It looks for both regular and zombie processes. This avoids allproc relocking
>   previously seen with pfind -> zpfind calls.
> 
> Modified:
>   head/sys/kern/kern_event.c
>   head/sys/kern/kern_proc.c
>   head/sys/kern/kern_sig.c
>   head/sys/sys/proc.h
> 
> Modified: head/sys/kern/kern_proc.c
> ==============================================================================
> --- head/sys/kern/kern_proc.c	Sat Nov 11 18:03:26 2017	(r325720)
> +++ head/sys/kern/kern_proc.c	Sat Nov 11 18:04:39 2017	(r325721)
> @@ -353,6 +353,23 @@ pfind(pid_t pid)
>  	return (p);
>  }
>  
> +/*
> + * Same as pfind but allow zombies.
> + */
> +struct proc *
> +pfind_any(pid_t pid)
> +{
> +	struct proc *p;
> +
> +	sx_slock(&allproc_lock);
> +	p = pfind_locked(pid);
> +	if (p == NULL)
> +		p = zpfind_locked(pid);
> +	sx_sunlock(&allproc_lock);
> +
> +	return (p);
> +}

Can't this be written as pget(pid, 0, &p)?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171112043244.GA1266>