From nobody Fri Dec 06 16:48:00 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y4cdF1vrhz5gXHF; Fri, 06 Dec 2024 16:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4cdD6hnNz4V5c; Fri, 6 Dec 2024 16:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733503680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gmA+SDBr5K+Tp6MjPV6RFfId1b3P99sFipZswojFnR4=; b=BVkLpLVmXahjAWqz7gDcTXfNeeoD3etCFFovtq2CqYLSOguWvGZwOLdc9vkhnViJ/d+s5t i77E4fXA2tlgpEPaIHV1r9GXh0KvRx8fsSOIBa5McHHuCJgkVzQR2dbtfEPPG/nDpj/kWh 587cGbfVbKLI7qcFpohU9RxE7eOA4CtDspOkuMWnHBRMQGhoiX4n1p0SJV0slkEhW9y40A DOQ7AuXWR5sSisWSZ4hmhijRMsNRV73j6oFqqQ2fDHCH7D1X0VwuRSx8zcyfWCJtDkmbi3 nmGF+5rIB3V3KylWgDX66qjOCFqEZk12QfWDspj1NTT+bXpcpugV0hisxULgwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733503680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gmA+SDBr5K+Tp6MjPV6RFfId1b3P99sFipZswojFnR4=; b=DulLY3yAPrxXSm9FXqCX+VOONf4u7inEdtgOc6QCsOqGHNFHHQIE/lxVa+QMHwCblb5LtE v7jxKlICkX66VdHbuYt4AU1e4TSvC629Px7AMgP2+CwYOVxn/NLJOzwZ+d5NqyGhpYpXia z22bAqlkMX7Q3SjLERigHE8+B1uEhF5ABR0AWErgSYgCaw/kyopQxp8UC6J7OrB5CS2Jy7 w3VPqttrACrlnorHBFFAjA10O3RWS3WmL476m43aOaApsZP/4Wk1gyfGrFUHJW+ofyhvgy aekVK62oBdzh/DKMcv65WGWrZSow1Rrn4JKC1norzXL2RL2q+iRcHvpYaHn5VQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733503680; a=rsa-sha256; cv=none; b=rwJTDHWaZiJyROCIUD8j0sGfW746R239eK7iCkh3J3DemlyEu+tPn1Oy9TSoH/jPnuQS8X idnGUC0MOoKhlPJxnhmyGRz3pW6HvCWaIwpaW3D3+KvQ7yZvwZE2YXDXKsraRVITpHhd78 INmLosXKge4iRD6y1goqssCMU6mWrELnSBTf+HtzbBfSldNh9pttbJkAn76bwXdHSI56Te 6iIjJ0UwPYZUP5ZD5ldAMegHEdWNFRGfv74noqlAoflXxoMSlm0YygBT3jKyYxEbpd8tH3 flCLbkhZQGmTEelf8fSY9YcTe1x8yZEVDsA6mrwkuGZeUHO/HDLwSfVfXoBEvA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y4cdD689KzlXK; Fri, 6 Dec 2024 16:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B6Gm0rV037267; Fri, 6 Dec 2024 16:48:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B6Gm0eq037264; Fri, 6 Dec 2024 16:48:00 GMT (envelope-from git) Date: Fri, 6 Dec 2024 16:48:00 GMT Message-Id: <202412061648.4B6Gm0eq037264@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 07d78399eb79 - main - pfind(9): Update to recent behavior List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 07d78399eb7994d45338f58a331dae9fb8fe1023 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=07d78399eb7994d45338f58a331dae9fb8fe1023 commit 07d78399eb7994d45338f58a331dae9fb8fe1023 Author: Yan-Hao Wang AuthorDate: 2024-12-06 16:23:35 +0000 Commit: Warner Losh CommitDate: 2024-12-06 16:47:31 +0000 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 --- share/man/man9/pfind.9 | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/share/man/man9/pfind.9 b/share/man/man9/pfind.9 index 48e34d65d6ab..ebcf7a565150 100644 --- a/share/man/man9/pfind.9 +++ b/share/man/man9/pfind.9 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 11, 2001 +.Dd December 3, 2024 .Dt PFIND 9 .Os .Sh NAME @@ -34,7 +34,9 @@ .Ft "struct proc *" .Fn pfind "pid_t pid" .Ft "struct proc *" -.Fn zpfind "pid_t pid" +.Fn pfind_any "pid_t pid" +.Ft "struct proc *" +.Fn pfind_any_locked "pid_t pid" .Sh DESCRIPTION .Fn pfind takes a @@ -47,36 +49,39 @@ is on the .Va allproc list. .Pp -.Fn zpfind +.Fn pfind_any takes a .Fa pid as its argument. -If -.Fn zpfind -finds a process whose PID is equal to that of argument -and is a zombie process, meaning that it must reside on the -.Va zombproc -list, -.Fn zpfind -returns a pointer to that -.Vt proc -structure. +.Fn pfind_any +searches the +.Va allproc +list and returns the first process whose PID matches and whose state is +.Va PRS_ZOMBIE . .Pp -Both -.Fn pfind +.Fn pfind_any_locked +is similar to +.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. +All three functions +.Fn pfind , +.Fn pfind_any , and -.Fn zpfind +.Fn pgfind_any_locked lock the .Vt proc -structure that is returned using -.Fn PROC_LOCK "p" . +structure before returning. .Sh RETURN VALUES -.Fn pfind +.Fn pfind , +.Fn pfind_any , and -.Fn zpfind -return a pointer to a +.Fn pfind_any_locked +return pointer to a .Vt proc -structure on success and a +structure on success or .Dv NULL on failure. .Sh SEE ALSO