Skip to content

Commit 07d7839

Browse files
Wang-Yan-Haobsdimp
authored andcommitted
pfind(9): Update to recent behavior
The pfind(9) manual page in FreeBSD contains outdated content, such as references to zpfind() and the zombproc list, which have already been removed. Instead, there are new functions available for process search, as defined in sys/proc.h: 1. pfind_any(): Finds a process (including zombies) by its ID. 2, pfind_any_locked(): Finds a process by its ID like pfind but doesn't find lock the process hash bucket. It assert the process hash bucket is lock or not. In the current FreeBSD implementation, the allproc list is used, and the `p->p_state` field can determine whether a process is a zombie or not. I have attempted to revise the pfind(9) manual page as shown in my patch. However, since English is not my native language, the documentation team may need to refine my patch or not use it. My primary goal is to highlight the outdated content for correction. [[ imp fixed a few markup bugs, tweaked language a little ]] PR: 283091 Reviewed by: imp
1 parent e7aec3c commit 07d7839

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

share/man/man9/pfind.9

+27-22
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2323
.\" SUCH DAMAGE.
2424
.\"
25-
.Dd July 11, 2001
25+
.Dd December 3, 2024
2626
.Dt PFIND 9
2727
.Os
2828
.Sh NAME
@@ -34,7 +34,9 @@
3434
.Ft "struct proc *"
3535
.Fn pfind "pid_t pid"
3636
.Ft "struct proc *"
37-
.Fn zpfind "pid_t pid"
37+
.Fn pfind_any "pid_t pid"
38+
.Ft "struct proc *"
39+
.Fn pfind_any_locked "pid_t pid"
3840
.Sh DESCRIPTION
3941
.Fn pfind
4042
takes a
@@ -47,36 +49,39 @@ is on the
4749
.Va allproc
4850
list.
4951
.Pp
50-
.Fn zpfind
52+
.Fn pfind_any
5153
takes a
5254
.Fa pid
5355
as its argument.
54-
If
55-
.Fn zpfind
56-
finds a process whose PID is equal to that of argument
57-
and is a zombie process, meaning that it must reside on the
58-
.Va zombproc
59-
list,
60-
.Fn zpfind
61-
returns a pointer to that
62-
.Vt proc
63-
structure.
56+
.Fn pfind_any
57+
searches the
58+
.Va allproc
59+
list and returns the first process whose PID matches and whose state is
60+
.Va PRS_ZOMBIE .
6461
.Pp
65-
Both
66-
.Fn pfind
62+
.Fn pfind_any_locked
63+
is similar to
64+
.Fn pfind_any
65+
,but it does not lock the process hash bucket
66+
for the given
67+
.Vt pid .
68+
Instead, it asserts the corresponding process hash bucket is already locked.
69+
All three functions
70+
.Fn pfind ,
71+
.Fn pfind_any ,
6772
and
68-
.Fn zpfind
73+
.Fn pgfind_any_locked
6974
lock the
7075
.Vt proc
71-
structure that is returned using
72-
.Fn PROC_LOCK "p" .
76+
structure before returning.
7377
.Sh RETURN VALUES
74-
.Fn pfind
78+
.Fn pfind ,
79+
.Fn pfind_any ,
7580
and
76-
.Fn zpfind
77-
return a pointer to a
81+
.Fn pfind_any_locked
82+
return pointer to a
7883
.Vt proc
79-
structure on success and a
84+
structure on success or
8085
.Dv NULL
8186
on failure.
8287
.Sh SEE ALSO

0 commit comments

Comments
 (0)