pfind(9): follow-up fixes and improvements

(Found on a branch from a year ago.)

- Adjust NAMEs
- MLINKS: add pfind_any.9, pfind_any_locked.9; remove old zpfind.9
- Reword the description of pfind_any() so that it doesn't imply only
  zombie processes are returned
- Fix a comma
- Use .Dv for the macro PRS_ZOMBIE
- Move the (logically separate) final statement to a new paragraph
- .Xr to pget(9)

Reviewed by:	0mp
Fixes:	07d78399eb ("pfind(9): Update to recent behavior")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D53548
This commit is contained in:
Mitchell Horne
2023-01-28 14:48:33 -04:00
parent ca3e47b0ea
commit 2ace05b65a
3 changed files with 22 additions and 18 deletions
+2 -1
View File
@@ -1853,7 +1853,8 @@ MLINKS+=pfil.9 pfil_add_hook.9 \
pfil.9 pfil_remove_hook.9 \
pfil.9 pfil_run_hooks.9 \
pfil.9 pfil_link.9
MLINKS+=pfind.9 zpfind.9
MLINKS+=pfind.9 pfind_any.9 \
pfind.9 pfind_any_locked.9
MLINKS+=PHOLD.9 PRELE.9 \
PHOLD.9 _PHOLD.9 \
PHOLD.9 _PRELE.9 \
+17 -17
View File
@@ -22,11 +22,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd December 3, 2024
.Dd November 3, 2025
.Dt PFIND 9
.Os
.Sh NAME
.Nm pfind , zpfind
.Nm pfind ,
.Nm pfind_any ,
.Nm pfind_any_locked
.Nd locate a process by number
.Sh SYNOPSIS
.In sys/param.h
@@ -38,16 +40,13 @@
.Ft "struct proc *"
.Fn pfind_any_locked "pid_t pid"
.Sh DESCRIPTION
The
.Fn pfind
takes a
.Fa pid
as its argument and returns a pointer to the
.Vt proc
structure whose PID is specified in the argument only if the
.Fa pid
is on the
.Va allproc
list.
function walks the list of processes in the system, looking for the one with a
process ID of
.Fa pid .
If the process exists, and is not in the zombie state, a pointer to the process
structure will be returned.
.Pp
.Fn pfind_any
takes a
@@ -56,21 +55,21 @@ as its argument.
.Fn pfind_any
searches the
.Va allproc
list and returns the first process whose PID matches and whose state is
.Va PRS_ZOMBIE .
list and returns the first process with a matching PID, whose state may be
.Dv PRS_ZOMBIE .
.Pp
.Fn pfind_any_locked
is similar to
.Fn pfind_any
,but it does not lock the process hash bucket
for the given
.Fn pfind_any ,
but it does not lock the process hash bucket for the given
.Vt pid .
Instead, it asserts the corresponding process hash bucket is already locked.
.Pp
All three functions
.Fn pfind ,
.Fn pfind_any ,
and
.Fn pgfind_any_locked
.Fn pfind_any_locked
lock the
.Vt proc
structure before returning.
@@ -85,6 +84,7 @@ structure on success or
.Dv NULL
on failure.
.Sh SEE ALSO
.Xr pget 9 ,
.Xr pgfind 9
.Sh AUTHORS
This manual page was written by