From nobody Fri Jan 19 18:34:31 2024 X-Original-To: freebsd-ports@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 4TGpF32X0bz576Lp; Fri, 19 Jan 2024 18:34:47 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TGpF22WQ5z4dvj; Fri, 19 Jan 2024 18:34:46 +0000 (UTC) (envelope-from mizhka@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b="Hm48qQ/g"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mizhka@gmail.com designates 2a00:1450:4864:20::535 as permitted sender) smtp.mailfrom=mizhka@gmail.com Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-55a38fb45c1so1281614a12.1; Fri, 19 Jan 2024 10:34:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705689284; x=1706294084; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=m6ONPr5ZQX4QeQUuaQqeX74krh7egSRYnWLqtF1BZqc=; b=Hm48qQ/gXHaPMxx3lBDq0wzNwCIGbDfuaGgYlNEUjQIhaIkqFO87B+qvTxVnoQkkFe dHegNsF0PxMqYz7CHV1ExFyiyBWc2mKul1Ix72aj3S0m1kDX0k0XsHBmamt0d6MOV+ru KLO1D8IG8UgQdxLO564TDbe5OKiyQiWAqv71pce7dQ1LM1wSW3RatoB1FKwQ+h55Z9jL S434q/yQAY7PJ8EPfocPE+o2WG4w0/54U4DGWcKSJKYjD8AiKERvR1ZshfkSnZrFa6Pd mtve+AQ7hl/szLR5OpTkSDB+QwyUZCZSnMdGylXedH2e2mToaqiGbkVgxa6OZDlCKBiX 8U0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705689284; x=1706294084; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m6ONPr5ZQX4QeQUuaQqeX74krh7egSRYnWLqtF1BZqc=; b=d99zFWOyajQmKnnIVdlNmjI0M6TUfEVfB6oSHHh21CMlrsWjZc4Ubk3E07xU708oDF v28QS0GQEgGu5uUHq/O5MpEohnnlvdyUd92OoVzT08Auntqr02GMEKC2nnd3FjcDiOMA c3BufLTFoVKKc/FtwmSW7QHXEmE6gw5ppwBKFDgivt710wzqu9xrKpENY2fr83q/YtqF cJa7AV6h02H9uBzGdNPAQkSAYxbqBNXszpPt5wa6pAtjAcLwPnYPSG1qIC14aqNa32Nl 9qBtIeX1h2udcSjYho9i9q4woI4dQ/67H15HPtCRbYRuoiFGwLyDRlq5xG1dEr3j7ckZ GSOA== X-Gm-Message-State: AOJu0YzSo00adEsxEDHvwt53i2H93QME1wQKzIDz0gsE01byT8d7Pa/i uctmT/mi/iJonVTKFGyP1B3Aa+8FoY8PYTwpv9Rova+ZkXSB9vKFlckbZTcZdgCIJLFGLA4Q1fv 6t2MILf76uFDhZQyjW7tcI/52VgrN4ECF X-Google-Smtp-Source: AGHT+IHkj4ZUxv8YBGGJ6z6cTQ/sPbs6OLULHbadD290+02nuBE7/gZFoLfJrLvVL2htpoKwHbSoVObK4dMZVmt3gJ0= X-Received: by 2002:a05:6402:35cd:b0:559:fa35:dadc with SMTP id z13-20020a05640235cd00b00559fa35dadcmr118193edc.77.1705689284112; Fri, 19 Jan 2024 10:34:44 -0800 (PST) List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 References: <20240119131047.6975f574@rimwks.local> In-Reply-To: <20240119131047.6975f574@rimwks.local> From: Michael Zhilin Date: Fri, 19 Jan 2024 21:34:31 +0300 Message-ID: Subject: Re: kcmp implementation for mesa To: Rozhuk Ivan Cc: FreeBSD Hackers , FreeBSD Mailing List Content-Type: multipart/alternative; boundary="000000000000e07473060f50bb6c" X-Spamd-Bar: --- X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; DKIM_TRACE(0.00)[gmail.com:+]; MISSING_XM_UA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::535:from]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org,freebsd-ports@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_RCPT(0.00)[]; FREEFALL_USER(0.00)[mizhka]; RCVD_COUNT_ONE(0.00)[1]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-Rspamd-Queue-Id: 4TGpF22WQ5z4dvj --000000000000e07473060f50bb6c Content-Type: text/plain; charset="UTF-8" Hi Ivan, Looks good. Could you please put patch on reviews.freebsd.org? Thx, Michael On Fri, 19 Jan 2024, 14:11 Rozhuk Ivan, wrote: > Hi! > > > graphics/mesa-* uses SYS_kcmp [1] to compare two fds: > > int > os_same_file_description(int fd1, int fd2) > { > pid_t pid = getpid(); > > /* Same file descriptor trivially implies same file description */ > if (fd1 == fd2) > return 0; > > return syscall(SYS_kcmp, pid, pid, KCMP_FILE, fd1, fd2); > } > > FreeBSD does not implemet this and we got in terminal: > "amdgpu: os_same_file_description couldn't determine if two DRM fds > reference the same file description." > > > Mesa say: > /* DRM file descriptors, file descriptions and buffer sharing. > * > * amdgpu_device_initialize first argument is a file descriptor (fd) > * representing a specific GPU. > * If a fd is duplicated using os_dupfd_cloexec, > * the file description will remain the same (os_same_file_description will > * return 0). > * But if the same device is re-opened, the fd and the file description > will > * be different. > * > * amdgpu_screen_winsys's fd tracks the file description which was > * given to amdgpu_winsys_create. This is the fd used by the application > * using the driver and may be used in other ioctl (eg: drmModeAddFB) > * > * amdgpu_winsys's fd is the file description used to initialize the > * device handle in libdrm_amdgpu. > * > * The 2 fds can be different, even in systems with a single GPU, eg: if > * radv is initialized before radeonsi. > * > * This fd tracking is useful for buffer sharing because KMS/GEM handles > are > * specific to a DRM file description, i.e. the same handle value may refer > * to different underlying BOs in different DRM file descriptions. > * As an example, if an app wants to use drmModeAddFB it'll need a KMS > handle > * valid for its fd (== amdgpu_screen_winsys::fd). > * If both fds are identical, there's nothing to do: bo->u.real.kms_handle > * can be used directly (see amdgpu_bo_get_handle). > * If they're different, the BO has to be exported from the device fd as > * a dma-buf, then imported from the app fd as a KMS handle. > */ > > > > I do few checks with dup() and os_dupfd_cloexec() and code show that fd > equal. > > Does this implementation will do that mesa expects? > > > #include > #include > > int > os_same_file_description(int fd1, int fd2) { > struct kinfo_file kif1, kif2; > > /* Same file descriptor trivially implies same file description */ > if (fd1 == fd2) > return (0); > > kif1.kf_structsize = sizeof(kif1); > kif2.kf_structsize = sizeof(kif2); > if (-1 == fcntl(fd1, F_KINFO, &kif1) || > -1 == fcntl(fd2, F_KINFO, &kif2)) > return (-1); > > if (kif1.kf_type != kif2.kf_type || > 0 != memcmp(&kif1.kf_path, &kif2.kf_path, > sizeof(kif1.kf_path))) > return (3); > > switch (kif1.kf_type) { > case KF_TYPE_VNODE: > if (0 == memcmp(&kif1.kf_un.kf_file, &kif2.kf_un.kf_file, > sizeof(kif1.kf_un.kf_file))) > return (0); > return (3); > case KF_TYPE_SOCKET: > if (0 == memcmp(&kif1.kf_un.kf_sock, &kif2.kf_un.kf_sock, > sizeof(kif1.kf_un.kf_sock))) > return (0); > return (3); > case KF_TYPE_PIPE: > if (0 == memcmp(&kif1.kf_un.kf_pipe, &kif2.kf_un.kf_pipe, > sizeof(kif1.kf_un.kf_pipe))) > return (0); > return (3); > //case KF_TYPE_FIFO: > case KF_TYPE_KQUEUE: > if (0 == memcmp(&kif1.kf_un.kf_kqueue, > &kif2.kf_un.kf_kqueue, > sizeof(kif1.kf_un.kf_kqueue))) > return (0); > return (3); > //case KF_TYPE_MQUEUE: > //case KF_TYPE_SHM: > case KF_TYPE_SEM: > if (0 == memcmp(&kif1.kf_un.kf_sem, &kif2.kf_un.kf_sem, > sizeof(kif1.kf_un.kf_sem))) > return (0); > return (3); > case KF_TYPE_PTS: > if (0 == memcmp(&kif1.kf_un.kf_pts, &kif2.kf_un.kf_pts, > sizeof(kif1.kf_un.kf_pts))) > return (0); > return (3); > case KF_TYPE_PROCDESC: > if (0 == memcmp(&kif1.kf_un.kf_proc, &kif2.kf_un.kf_proc, > sizeof(kif1.kf_un.kf_proc))) > return (0); > return (3); > //case KF_TYPE_DEV: > case KF_TYPE_EVENTFD: > if (0 == memcmp(&kif1.kf_un.kf_eventfd, > &kif2.kf_un.kf_eventfd, > sizeof(kif1.kf_un.kf_eventfd))) > return (0); > return (3); > case KF_TYPE_TIMERFD: > if (0 == memcmp(&kif1.kf_un.kf_timerfd, > &kif2.kf_un.kf_timerfd, > sizeof(kif1.kf_un.kf_timerfd))) > return (0); > return (3); > } > /* Otherwise we can't tell */ > return (-1); > } > > > Refs: > 1. https://man7.org/linux/man-pages/man2/kcmp.2.html > > > --000000000000e07473060f50bb6c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Ivan,=C2=A0

Looks good. Could you please put patch on reviews.freebsd.org?=C2=A0

Thx,=C2=A0
Michael

On Fri, 19 J= an 2024, 14:11 Rozhuk Ivan, <rozh= uk.im@gmail.com> wrote:
Hi!<= br>

graphics/mesa-* uses SYS_kcmp [1] to compare two fds:

int
os_same_file_description(int fd1, int fd2)
{
=C2=A0 =C2=A0pid_t pid =3D getpid();

=C2=A0 =C2=A0/* Same file descriptor trivially implies same file descriptio= n */
=C2=A0 =C2=A0if (fd1 =3D=3D fd2)
=C2=A0 =C2=A0 =C2=A0 return 0;

=C2=A0 =C2=A0return syscall(SYS_kcmp, pid, pid, KCMP_FILE, fd1, fd2);
}

FreeBSD does not implemet this and we got in terminal:
"amdgpu: os_same_file_description couldn't determine if two DRM fd= s reference the same file description."


Mesa say:
/* DRM file descriptors, file descriptions and buffer sharing.
=C2=A0*
=C2=A0* amdgpu_device_initialize first argument is a file descriptor (fd) =C2=A0* representing a specific GPU.
=C2=A0* If a fd is duplicated using os_dupfd_cloexec,
=C2=A0* the file description will remain the same (os_same_file_description= will
=C2=A0* return 0).
=C2=A0* But if the same device is re-opened, the fd and the file descriptio= n will
=C2=A0* be different.
=C2=A0*
=C2=A0* amdgpu_screen_winsys's fd tracks the file description which was=
=C2=A0* given to amdgpu_winsys_create. This is the fd used by the applicati= on
=C2=A0* using the driver and may be used in other ioctl (eg: drmModeAddFB)<= br> =C2=A0*
=C2=A0* amdgpu_winsys's fd is the file description used to initialize t= he
=C2=A0* device handle in libdrm_amdgpu.
=C2=A0*
=C2=A0* The 2 fds can be different, even in systems with a single GPU, eg: = if
=C2=A0* radv is initialized before radeonsi.
=C2=A0*
=C2=A0* This fd tracking is useful for buffer sharing because KMS/GEM handl= es are
=C2=A0* specific to a DRM file description, i.e. the same handle value may = refer
=C2=A0* to different underlying BOs in different DRM file descriptions.
=C2=A0* As an example, if an app wants to use drmModeAddFB it'll need a= KMS handle
=C2=A0* valid for its fd (=3D=3D amdgpu_screen_winsys::fd).
=C2=A0* If both fds are identical, there's nothing to do: bo->u.real= .kms_handle
=C2=A0* can be used directly (see amdgpu_bo_get_handle).
=C2=A0* If they're different, the BO has to be exported from the device= fd as
=C2=A0* a dma-buf, then imported from the app fd as a KMS handle.
=C2=A0*/



I do few checks with dup() and os_dupfd_cloexec() and code show that fd equ= al.

Does this implementation will do that mesa expects?


#include <sys/user.h>
#include <fcntl.h>

int
os_same_file_description(int fd1, int fd2) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct kinfo_file kif1, kif2;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Same file descriptor trivially implies same = file description */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (fd1 =3D=3D fd2)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0);

=C2=A0 =C2=A0 =C2=A0 =C2=A0 kif1.kf_structsize =3D sizeof(kif1);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 kif2.kf_structsize =3D sizeof(kif2);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (-1 =3D=3D fcntl(fd1, F_KINFO, &kif1) ||=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -1 =3D=3D fcntl(fd2, F_KINFO, &am= p;kif2))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (-1);

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (kif1.kf_type !=3D kif2.kf_type ||
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 !=3D memcmp(&kif1.kf_path, = &kif2.kf_path, sizeof(kif1.kf_path)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);

=C2=A0 =C2=A0 =C2=A0 =C2=A0 switch (kif1.kf_type) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_VNODE:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_file, &kif2.kf_un.kf_file,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_file)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_SOCKET:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_sock, &kif2.kf_un.kf_sock,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_sock)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_PIPE:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_pipe, &kif2.kf_un.kf_pipe,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_pipe)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 //case KF_TYPE_FIFO:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_KQUEUE:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_kqueue, &kif2.kf_un.kf_kqueue,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_kqueue)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 //case KF_TYPE_MQUEUE:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 //case KF_TYPE_SHM:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_SEM:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_sem, &kif2.kf_un.kf_sem,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_sem)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_PTS:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_pts, &kif2.kf_un.kf_pts,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_pts)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_PROCDESC:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_proc, &kif2.kf_un.kf_proc,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_proc)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 //case KF_TYPE_DEV:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_EVENTFD:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_eventfd, &kif2.kf_un.kf_eventfd,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_eventfd)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case KF_TYPE_TIMERFD:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (0 =3D=3D memcmp= (&kif1.kf_un.kf_timerfd, &kif2.kf_un.kf_timerfd,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(kif1.kf_un.kf_timerfd)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 return (0);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (3);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Otherwise we can't tell */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return (-1);
}


Refs:
1. https://man7.org/linux/man-pages/man2= /kcmp.2.html


--000000000000e07473060f50bb6c--