From nobody Wed Jan 31 00:46:10 2024 X-Original-To: dev-commits-src-all@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 4TPjyW1mKvz580Zp; Wed, 31 Jan 2024 00:46:11 +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 4TPjyV6rBYz45KZ; Wed, 31 Jan 2024 00:46:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706661971; 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=8Fcz90f/J2DPswxTigoalvGaWmTj6xeYPNn/OUeSugM=; b=LeyxPVbVWbJtYDtfSsH2Dx0f6m7A9m4ervpol96qm1z1058BE18BDnEWqeupuArGyhMGJz jggHrKITtFsuWxaJBCO48rVKZ0HrKu8gQfZ+SOHBziOeR3+92vFQPEZvmrNuwu8Asr+1/J b/ZMd3XlUuhQseuTqoQMd2MEMiwsHTC+gZW9ND9lV4x6tqfERRLAwa9oeihbozdMcWgwpu hWxcFD+WF9szKFPh05LmfonLx4M0t3g+QUaBcCj1tAnnQ5rp5AC5bNR0wqZlpkETqjPQ1x NjIccYJ7JhhPn7/hNeDPB2OQbtpSgBtXsHb6mkxK4LmLCCflmYFgIzkz7TZolg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706661971; 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=8Fcz90f/J2DPswxTigoalvGaWmTj6xeYPNn/OUeSugM=; b=h8VwFhG8/9chlYgwul1gg0La6JdRRo/7sS7WyF/slpz01F+YHEHzdiBxsctileytgvKCz/ FcElZ86tk4ZlNruu/uADQvgobQnVinZKtbvKNgF0t34jTVhfJF64Tm+uDaYeukJPftxx/G Zz2sj+sfn7UbWkJkmj/fMqBAjmiH9hSbuHuXyyC+r8YT6SkplCfWnKM9x+Az8L1jvX/J/E AX+BrKBAD/4DFOvDR9FlxkBxPBBBfffvpmfOXfqwIeh5+p+lJBvY8XnZF7sGlEaaf5Yo6Q qOWf8e06g3pjSmHH2PJpfaLLU++U72cAwbJ+lm/HXDW4DT/s8Tdt5d8GgTYUsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706661971; a=rsa-sha256; cv=none; b=bScEWJ2UGFuXFnbeeCk5r947hGAe1EYUi4vhEoDKvZGJRI1pas5w2NjPCceWE2TyGFp9vP +Eoz33HdIYPB98TpNlGVPOl5Pv4vUB6bzf5ztsrK6V0p76jtHL+YQMG6XVX941UFH5taRj ns+Pel9yJld4MDLkIOeVDPZE+nAvqmcXcCdEclGfFp11AR7LwKLGs2npMzj4bSH9QMPSFF TJCr9Rn136yVHqhFlOmE+is6TViKaJGGW9JSHryNTsgwYyR3ZA2QrqxPxceFi4dgvacNNK D43T938zMTIsCybY7x4YYIqLiDfpcxVIKhKr62U83FXP6Z1fgE9+P4tkwsXWlw== 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 4TPjyV5sVSzxwG; Wed, 31 Jan 2024 00:46:10 +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 40V0kA9C063489; Wed, 31 Jan 2024 00:46:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40V0kAou063486; Wed, 31 Jan 2024 00:46:10 GMT (envelope-from git) Date: Wed, 31 Jan 2024 00:46:10 GMT Message-Id: <202401310046.40V0kAou063486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 575a909aa243 - stable/14 - kcmp(2): implement for generic file types List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 575a909aa2430fcfe5b8ca8ae0d063a8b775fe4b Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=575a909aa2430fcfe5b8ca8ae0d063a8b775fe4b commit 575a909aa2430fcfe5b8ca8ae0d063a8b775fe4b Author: Konstantin Belousov AuthorDate: 2024-01-19 21:44:37 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-30 20:24:42 +0000 kcmp(2): implement for generic file types (cherry picked from commit f28526e9466cd60ed33053e922238ba1c9040341) --- sys/kern/kern_event.c | 1 + sys/kern/sys_eventfd.c | 1 + sys/kern/sys_generic.c | 8 ++++++++ sys/kern/sys_pipe.c | 1 + sys/kern/sys_socket.c | 1 + sys/kern/sys_timerfd.c | 1 + sys/kern/tty_pts.c | 1 + sys/kern/uipc_mqueue.c | 1 + sys/kern/uipc_sem.c | 1 + sys/kern/uipc_shm.c | 1 + sys/sys/file.h | 1 + 11 files changed, 18 insertions(+) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 540fd58d2e2a..41295c374e65 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -139,6 +139,7 @@ static struct fileops kqueueops = { .fo_chmod = invfo_chmod, .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, + .fo_cmp = file_kcmp_generic, .fo_fill_kinfo = kqueue_fill_kinfo, }; diff --git a/sys/kern/sys_eventfd.c b/sys/kern/sys_eventfd.c index 5efad129edae..739dbf75b01e 100644 --- a/sys/kern/sys_eventfd.c +++ b/sys/kern/sys_eventfd.c @@ -77,6 +77,7 @@ static struct fileops eventfdops = { .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = eventfd_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index b3aaa2956d6f..c999bd60f95d 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -2160,3 +2160,11 @@ sys_kcmp(struct thread *td, struct kcmp_args *uap) return (kern_kcmp(td, uap->pid1, uap->pid2, uap->type, uap->idx1, uap->idx2)); } + +int +file_kcmp_generic(struct file *fp1, struct file *fp2, struct thread *td) +{ + if (fp1->f_type != fp2->f_type) + return (3); + return (kcmp_cmp((uintptr_t)fp1->f_data, (uintptr_t)fp2->f_data)); +} diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 6e64ff41db0a..1c8d72f70a92 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -166,6 +166,7 @@ struct fileops pipeops = { .fo_chown = pipe_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = pipe_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 6c7c1de94f5b..45b458f81f19 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -112,6 +112,7 @@ struct fileops socketops = { .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = soo_fill_kinfo, .fo_aio_queue = soo_aio_queue, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index e245baed88be..d9c0e189baf2 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -371,6 +371,7 @@ static struct fileops timerfdops = { .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = timerfd_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE, }; diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index 31122d422a28..4a3b3d77c89e 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -610,6 +610,7 @@ static struct fileops ptsdev_ops = { .fo_chown = invfo_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = ptsdev_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE, }; diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index f4660be70da8..f7695945fcc4 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -2661,6 +2661,7 @@ static struct fileops mqueueops = { .fo_chown = mqf_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = mqf_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE, }; diff --git a/sys/kern/uipc_sem.c b/sys/kern/uipc_sem.c index d3c77a37400a..b4652e9106ac 100644 --- a/sys/kern/uipc_sem.c +++ b/sys/kern/uipc_sem.c @@ -153,6 +153,7 @@ static struct fileops ksem_ops = { .fo_chown = ksem_chown, .fo_sendfile = invfo_sendfile, .fo_fill_kinfo = ksem_fill_kinfo, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE }; diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index a8e2502808a0..1b9434aa438c 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -169,6 +169,7 @@ struct fileops shm_ops = { .fo_add_seals = shm_add_seals, .fo_fallocate = shm_fallocate, .fo_fspacectl = shm_fspacectl, + .fo_cmp = file_kcmp_generic, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE, }; diff --git a/sys/sys/file.h b/sys/sys/file.h index 540f1f525736..bfc2c6ab4652 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -281,6 +281,7 @@ fo_seek_t vn_seek; fo_fill_kinfo_t vn_fill_kinfo; fo_kqfilter_t vn_kqfilter_opath; int vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif); +int file_kcmp_generic(struct file *fp1, struct file *fp2, struct thread *td); void finit(struct file *, u_int, short, void *, struct fileops *); void finit_vnode(struct file *, u_int, void *, struct fileops *);