git: c9df56573aaf - 2024Q1 - graphics/mesa: Add a patch for testing kcmp

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 01 Feb 2024 09:32:24 UTC
The branch 2024Q1 has been updated by manu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c9df56573aaf62d79e2535309390d2744e67ff0c

commit c9df56573aaf62d79e2535309390d2744e67ff0c
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2024-01-25 12:49:49 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-02-01 09:28:43 +0000

    graphics/mesa: Add a patch for testing kcmp
    
    Upstream patch is based on the mesa main branch and this branch have
    extra checks for kcmp, add those test locally as they are not in 23.3.4
    
    Fixes:          2080c2eddaca ("graphics/mesa: Update to 23.3.4")
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    
    (cherry picked from commit 168e1199a5020101ba16eb7e69feb0fc3d76371a)
---
 graphics/mesa-dri/files/patch-src_util_os__file.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/graphics/mesa-dri/files/patch-src_util_os__file.c b/graphics/mesa-dri/files/patch-src_util_os__file.c
new file mode 100644
index 000000000000..f1bb54593c5a
--- /dev/null
+++ b/graphics/mesa-dri/files/patch-src_util_os__file.c
@@ -0,0 +1,22 @@
+--- src/util/os_file.c.orig	2024-01-25 12:45:07 UTC
++++ src/util/os_file.c
+@@ -207,13 +207,19 @@ os_same_file_description(int fd1, int fd2)
+ int
+ os_same_file_description(int fd1, int fd2)
+ {
++#ifdef SYS_kcmp
+    pid_t pid = getpid();
++#endif
+ 
+    /* Same file descriptor trivially implies same file description */
+    if (fd1 == fd2)
+       return 0;
+ 
++#ifdef SYS_kcmp
+    return syscall(SYS_kcmp, pid, pid, KCMP_FILE, fd1, fd2);
++#else
++   return -1;
++#endif
+ }
+ 
+ #else