Module: wine Branch: master Commit: 979099a441682c99ee0c1ee1fab5e1de635a579c URL: http://source.winehq.org/git/wine.git/?a=commit;h=979099a441682c99ee0c1ee1fa...
Author: Detlef Riekenberg wine.dev@web.de Date: Fri May 18 01:03:31 2012 +0200
ntdll: Read the current processor with the __NR_getcpu syscall.
---
dlls/ntdll/thread.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index b34e279..881d961 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -30,6 +30,9 @@ #ifdef HAVE_SYS_TIMES_H #include <sys/times.h> #endif +#ifdef HAVE_SYS_SYSCALL_H +#include <sys/syscall.h> +#endif
#define NONAMELESSUNION #include "ntstatus.h" @@ -1184,6 +1187,11 @@ ULONG WINAPI NtGetCurrentProcessorNumber(void) { ULONG processor;
+#if defined(__linux__) && defined(__NR_getcpu) + int res = syscall(__NR_getcpu, &processor); + if (res != -1) return processor; +#endif + if (NtCurrentTeb()->Peb->NumberOfProcessors > 1) { ULONG_PTR thread_mask, processor_mask;