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
+3
View File
@@ -51,6 +51,9 @@
# xargs -n1 | sort | uniq -d; # xargs -n1 | sort | uniq -d;
# done # done
# 20251204: zpfind.9 alias to pfind.9 removed
OLD_FILES+=usr/share/man/man9/zpfind.9
# 20251121: Remove duplicate pam_krb5 manual page # 20251121: Remove duplicate pam_krb5 manual page
OLD_FILES+=usr/share/man/man8/pam-krb5.8.gz OLD_FILES+=usr/share/man/man8/pam-krb5.8.gz
+2 -1
View File
@@ -1853,7 +1853,8 @@ MLINKS+=pfil.9 pfil_add_hook.9 \
pfil.9 pfil_remove_hook.9 \ pfil.9 pfil_remove_hook.9 \
pfil.9 pfil_run_hooks.9 \ pfil.9 pfil_run_hooks.9 \
pfil.9 pfil_link.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 \ MLINKS+=PHOLD.9 PRELE.9 \
PHOLD.9 _PHOLD.9 \ PHOLD.9 _PHOLD.9 \
PHOLD.9 _PRELE.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 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd December 3, 2024 .Dd November 3, 2025
.Dt PFIND 9 .Dt PFIND 9
.Os .Os
.Sh NAME .Sh NAME
.Nm pfind , zpfind .Nm pfind ,
.Nm pfind_any ,
.Nm pfind_any_locked
.Nd locate a process by number .Nd locate a process by number
.Sh SYNOPSIS .Sh SYNOPSIS
.In sys/param.h .In sys/param.h
@@ -38,16 +40,13 @@
.Ft "struct proc *" .Ft "struct proc *"
.Fn pfind_any_locked "pid_t pid" .Fn pfind_any_locked "pid_t pid"
.Sh DESCRIPTION .Sh DESCRIPTION
The
.Fn pfind .Fn pfind
takes a function walks the list of processes in the system, looking for the one with a
.Fa pid process ID of
as its argument and returns a pointer to the .Fa pid .
.Vt proc If the process exists, and is not in the zombie state, a pointer to the process
structure whose PID is specified in the argument only if the structure will be returned.
.Fa pid
is on the
.Va allproc
list.
.Pp .Pp
.Fn pfind_any .Fn pfind_any
takes a takes a
@@ -56,21 +55,21 @@ as its argument.
.Fn pfind_any .Fn pfind_any
searches the searches the
.Va allproc .Va allproc
list and returns the first process whose PID matches and whose state is list and returns the first process with a matching PID, whose state may be
.Va PRS_ZOMBIE . .Dv PRS_ZOMBIE .
.Pp .Pp
.Fn pfind_any_locked .Fn pfind_any_locked
is similar to is similar to
.Fn pfind_any .Fn pfind_any ,
,but it does not lock the process hash bucket but it does not lock the process hash bucket for the given
for the given
.Vt pid . .Vt pid .
Instead, it asserts the corresponding process hash bucket is already locked. Instead, it asserts the corresponding process hash bucket is already locked.
.Pp
All three functions All three functions
.Fn pfind , .Fn pfind ,
.Fn pfind_any , .Fn pfind_any ,
and and
.Fn pgfind_any_locked .Fn pfind_any_locked
lock the lock the
.Vt proc .Vt proc
structure before returning. structure before returning.
@@ -85,6 +84,7 @@ structure on success or
.Dv NULL .Dv NULL
on failure. on failure.
.Sh SEE ALSO .Sh SEE ALSO
.Xr pget 9 ,
.Xr pgfind 9 .Xr pgfind 9
.Sh AUTHORS .Sh AUTHORS
This manual page was written by This manual page was written by