`sched_getcpu()` has been supported since glibc 2.6 (2007), and is faster since it can use a vsyscall. Plus, FreeBSD implements it as well.
-- v2: ntdll: Use sched_getcpu instead of the getcpu syscall.
From: Brendan Shanks bshanks@codeweavers.com
--- configure.ac | 1 + dlls/ntdll/unix/thread.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac index ae5910150bd..32c7be2482f 100644 --- a/configure.ac +++ b/configure.ac @@ -2079,6 +2079,7 @@ AC_CHECK_FUNCS(\ posix_fadvise \ posix_fallocate \ prctl \ + sched_getcpu \ sched_yield \ setproctitle \ setprogname \ diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index d0fdc37171a..cec6b3cb106 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -37,6 +37,9 @@ #include <sys/types.h> #include <unistd.h> #include <sys/mman.h> +#ifdef HAVE_SCHED_H +#include <sched.h> +#endif #ifdef HAVE_SYS_TIMES_H #include <sys/times.h> #endif @@ -2560,9 +2563,9 @@ ULONG WINAPI NtGetCurrentProcessorNumber(void) { ULONG processor;
-#if defined(__linux__) && defined(__NR_getcpu) - int res = syscall(__NR_getcpu, &processor, NULL, NULL); - if (res != -1) return processor; +#if defined(HAVE_SCHED_GETCPU) + int res = sched_getcpu(); + if (res >= 0) return res; #elif defined(__APPLE__) && (defined(__x86_64__) || defined(__i386__)) struct { unsigned long p1, p2;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150228
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/ntdll/unix/thread.c:2560 Task: Patch failed to apply
=== debian11b (build log) ===
error: patch failed: dlls/ntdll/unix/thread.c:2560 Task: Patch failed to apply
This merge request was approved by Marc-Aurel Zent.