Commit 979099a4 authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

ntdll: Read the current processor with the __NR_getcpu syscall.

parent 0e235e5d
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#ifdef HAVE_SYS_TIMES_H #ifdef HAVE_SYS_TIMES_H
#include <sys/times.h> #include <sys/times.h>
#endif #endif
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
#define NONAMELESSUNION #define NONAMELESSUNION
#include "ntstatus.h" #include "ntstatus.h"
...@@ -1184,6 +1187,11 @@ ULONG WINAPI NtGetCurrentProcessorNumber(void) ...@@ -1184,6 +1187,11 @@ ULONG WINAPI NtGetCurrentProcessorNumber(void)
{ {
ULONG processor; 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) if (NtCurrentTeb()->Peb->NumberOfProcessors > 1)
{ {
ULONG_PTR thread_mask, processor_mask; ULONG_PTR thread_mask, processor_mask;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment