From nobody Wed Jan 24 05:12:23 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 4TKXBw1XSyz57TKf; Wed, 24 Jan 2024 05:12:24 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TKXBv6Qz7z4ZH8; Wed, 24 Jan 2024 05:12:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706073143; 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=0iKht9BB2olDfEUmQQGo+qrR8qqOyoxe6gJDNNL35Xs=; b=OC9ugUuyApbzANoXCwduhM+/I5gKPqCw58dH0UTGYF2E2yHWv1iSe6VdHc/gD9Nk40EW7Y aRyMG7oWwpjquHL1F7+LLPfbP/ShMxzvql6yh1Xt76llgOWdPSUXAotrcK7vvBpPQurdN9 dhjl24P8aM7f73Cpo3YC3pNAj+0CdV3cPgE0CEoGNlf4F60vLJcc0sjkbIW2jdQHyw+bI/ 6xVZhOK3BGTnD6CPyXvrfsPtCKHwc6F5nYOEN9JQGVgYGpkTF08y+NtE5UWgl33xCkH7pi IGw+UWZv8nOiYrtVt9ow7utUtsXM6TwDvQUIiLC6kIZY52KzxvH5L2mUOXDAiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706073143; 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=0iKht9BB2olDfEUmQQGo+qrR8qqOyoxe6gJDNNL35Xs=; b=b90BBEgUKW5kSdOFDWFsNzXt9QPbKlbJfpt/uFbr1B/z9P+Q89MxMMKaRf0IyqXDMCAmxX ysLmkSAOMKuB5bdXA4aphhaxWM4kVNheSFO85xvqH1fTAtvZS5GphrKgyV1hENLBeIQxDG uvnz5jM77ggan9ldQ1EAcdu9KlLX1gX1Q+VEGGKgC6mp0eFUOOHM/gtIVvaf8EXQh4aB/m UoOsbxO9ZExaNwOjSK2IGojF7H4eWefcZvSUDOBrcMbfS8mrJAicijGI3crKS3LlCN9aue 0TU2gz3X4Vs9jAWSEFbrLW1DsAXklsy1PCaPgqXb/+4C4h9Bp/We1mO40sjVMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706073143; a=rsa-sha256; cv=none; b=KkkT2UWV6DVKvkmGfWoRLh+4ylr9RgvUq3pk/7E9+hIcYCvuPNJljeemQjZ/CC3/th+q9k koC4lEyrns7yMaykPKmU2XtDFIcywrFti5XrXnm+EJ/IJU2jQUntfJg44TqcaJJriT17WG 2vdEHH6kQ/IhSj11/DEOlwkVeg92Q4BRzKuWLzpmSjTa3CCgucWZkC/o3ggnvvwo2uswlW 7SsCvn6bJRBTtF7Iu8Gt6seBOJDcQiNsM7qfxBXKCj/8+0eazvSltL751QS75zgL/AvKso /lQszIfywnT4NShGB+VO+HVtlXH6630KZGl3ZRDe9AVNonvVPNR1pxWjSiAeeQ== 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 4TKXBv5Vzgz11Vx; Wed, 24 Jan 2024 05:12:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40O5CNig041300; Wed, 24 Jan 2024 05:12:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40O5CNWQ041297; Wed, 24 Jan 2024 05:12:23 GMT (envelope-from git) Date: Wed, 24 Jan 2024 05:12:23 GMT Message-Id: <202401240512.40O5CNWQ041297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f006524d6d69 - main - kcmp(2): implement for procdesc 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f006524d6d696cc2a10b9e90a9a6ea412f1839eb Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f006524d6d696cc2a10b9e90a9a6ea412f1839eb commit f006524d6d696cc2a10b9e90a9a6ea412f1839eb Author: Konstantin Belousov AuthorDate: 2024-01-19 22:37:39 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-24 05:11:27 +0000 kcmp(2): implement for procdesc Reviewed by: brooks, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43518 --- sys/kern/sys_procdesc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 419ff928a8a2..90022186d1ff 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -94,6 +94,7 @@ static fo_kqfilter_t procdesc_kqfilter; static fo_stat_t procdesc_stat; static fo_close_t procdesc_close; static fo_fill_kinfo_t procdesc_fill_kinfo; +static fo_cmp_t procdesc_cmp; static struct fileops procdesc_ops = { .fo_read = invfo_rdwr, @@ -108,6 +109,7 @@ static struct fileops procdesc_ops = { .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = procdesc_fill_kinfo, + .fo_cmp = procdesc_cmp, .fo_flags = DFLAG_PASSABLE, }; @@ -552,3 +554,15 @@ procdesc_fill_kinfo(struct file *fp, struct kinfo_file *kif, kif->kf_un.kf_proc.kf_pid = pdp->pd_pid; return (0); } + +static int +procdesc_cmp(struct file *fp1, struct file *fp2, struct thread *td) +{ + struct procdesc *pdp1, *pdp2; + + if (fp2->f_type != DTYPE_PROCDESC) + return (3); + pdp1 = fp1->f_data; + pdp2 = fp2->f_data; + return (kcmp_cmp((uintptr_t)pdp1->pd_pid, (uintptr_t)pdp2->pd_pid)); +}