package/mesa3d: add compile patch for linux < 3.5
PATCH 1/1 package/mesa3d: add compile patch for linux < 3.5
The kcmp() system call first appeared in linux 3.5, and was also not there before linux 5.12 if CONFIG_CHECKPOINT_RESTORE was not set.
See: https://man7.org/linux/man-pages/man2/kcmp.2.html
--- ...e_description-fix-unknown-linux-3.5-.patch | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 package/mesa3d/0005-util-os_same_file_description-fix-unknown-linux-3.5-.patch
package/mesa3d/0005-util-os_same_file_description-fix-unknown-linux-3.5-.patch new file +70 -0
@@ -0,0 +1,70 @@ +From b60974fac8a2f4c85cbb2ca788fc4ec3e81998f9 Mon Sep 17 00:00:00 2001 +From: Thomas Devoogdt <[email protected]> +Date: Tue, 17 Aug 2021 11:54:49 +0200 +Subject: [PATCH] util: os_same_file_description: fix unknown linux < 3.5 + syscall SYS_kcmp +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +https://man7.org/linux/man-pages/man2/kcmp.2.html + +The kcmp() system call first appeared in Linux 3.5. + +But was probably also not supported by all major platforms +at that time. So fallback to the check that is done for windows. + +Signed-off-by: Thomas Devoogdt <[email protected]> +Acked-by: Yonggang Luo <[email protected]> +Acked-by: Michel Dänzer <[email protected]> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18517> +(cherry picked from commit 3ef514982441ce496aa127611edd26b9867f4b95) +Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18517 +Signed-off-by: Thomas Devoogdt <[email protected]> +--- + src/util/os_file.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +diff --git a/src/util/os_file.c b/src/util/os_file.c +index 5fb30f2d908..464425a9b87 100644 +--- a/src/util/os_file.c ++++ b/src/util/os_file.c +@@ -202,29 +202,23 @@ os_read_file(const char *filename, size_t *size) + /* copied from <linux/kcmp.h> */ + #define KCMP_FILE 0 + ++#endif ++ + 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 +- +-int +-os_same_file_description(int fd1, int fd2) +-{ +- /* Same file descriptor trivially implies same file description */ +- if (fd1 == fd2) +- return 0; +- + /* Otherwise we can't tell */ + return -1; +-} +- + #endif ++} +-- +2.34.1 +
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 18 lines · On Tue, 12 Dec 2023 14:56:34 +0100 Thomas Devoogdt <[email protected]> wrote:
package/mesa3d/0005-util-os_same_file_description-fix-unknown-linux-3.5-.patch new file +12
-0@@ -0,0 +1,70 @@ +From b60974fac8a2f4c85cbb2ca788fc4ec3e81998f9 Mon Sep 17 00:00:00 2001 +From: Thomas Devoogdt <[email protected]> +Date: Tue, 17 Aug 2021 11:54:49 +0200 +Subject: [PATCH] util: os_same_file_description: fix unknown linux < 3.5 + syscall SYS_kcmp +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +https://man7.org/linux/man-pages/man2/kcmp.2.html + +The kcmp() system call first appeared in Linux 3.5.
package/mesa3d/0005-util-os_same_file_description-fix-unknown-linux-3.5-.patch line 22
Quoted 10 lines
package/mesa3d/0005-util-os_same_file_description-fix-unknown-linux-3.5-.patch new file +10
-0+ +But was probably also not supported by all major platforms +at that time. So fallback to the check that is done for windows. + +Signed-off-by: Thomas Devoogdt <[email protected]> +Acked-by: Yonggang Luo <[email protected]> +Acked-by: Michel Dänzer <[email protected]> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18517> +(cherry picked from commit 3ef514982441ce496aa127611edd26b9867f4b95) +Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18517
I've simplified those 3 lines to just:
Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/commit/3ef514982441ce496aa127611edd26b9867f4b95
And applied. Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Devoogdt <[email protected]> writes:
The
kcmp()system call first appeared in linux 3.5, and was also not there before linux 5.12 ifCONFIG_CHECKPOINT_RESTOREwas not set.See: https://man7.org/linux/man-pages/man2/kcmp.2.html
Signed-off-by Thomas Devoogdt <[email protected]>
Committed to 2023.02.x and 2023.11.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot