ntdll: Read the current processor with the __NR_getcpu syscall.

This commit is contained in:
Detlef Riekenberg 2012-05-18 01:03:31 +02:00 committed by Alexandre Julliard
parent 0e235e5dc6
commit 979099a441
1 changed files with 8 additions and 0 deletions

View File

@ -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;