[gcompat] [PATCH] pthread: add __sched_{cpualloc,cpufree}.

From: Érico Nogueira <ericonr_at_disroot.org>
Date: Thu, 10 Sep 2020 03:42:03 -0300

Implemented using the CPU_{ALLOC,FREE} macros.

These symbols are required by nvidia 450.57 binaries.
---
nvidia-smi, when launched as:
    LD_PRELOAD=/usr/lib/libtirpc.so.3:/usr/lib/libnvidia-ml.so nvidia-smi
complained about missing those symbols. Adding them into libgcompat was
enough for it to run.
 libgcompat/pthread.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/libgcompat/pthread.c b/libgcompat/pthread.c
index 4357d74..19adceb 100644
--- a/libgcompat/pthread.c
+++ b/libgcompat/pthread.c
_at__at_ -2,7 +2,7 _at__at_
 #include <errno.h>   /* errno */
 #include <fcntl.h>   /* O_CLOEXEC, O_RDONLY */
 #include <pthread.h> /* pthread_atfork */
-#include <sched.h>   /* sched_yield */
+#include <sched.h>   /* sched_yield, CPU_ALLOC, CPU_FREE */
 #include <unistd.h>  /* open, read */
 
 #include "alias.h" /* weak_alias */
_at__at_ -61,3 +61,19 _at__at_ int pthread_yield(void)
 {
 	return sched_yield();
 }
+
+/**
+ * Allocate a large enough CPU set
+ */
+cpu_set_t *__sched_cpualloc(size_t _count)
+{
+	return CPU_ALLOC(__count);
+}
+
+/**
+ * Free a CPU set allocated by __sched_cpualloc
+ */
+void __sched_cpufree(cpu_set_t *__set)
+{
+	return CPU_FREE(__set);
+}
-- 
2.28.0
Received on Thu Sep 10 2020 - 06:53:31 UTC

This archive was generated by hypermail 2.4.0 : Sat May 08 2021 - 22:54:40 UTC