Re: kcmp implementation for mesa

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Fri, 19 Jan 2024 18:50:04 UTC
Rozhuk Ivan <rozhuk.im@gmail.com> writes:

> 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."

See https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6881
It's already applied in graphics/mesa-devel.