ntdll: Read the current processor with the __NR_getcpu syscall.
This commit is contained in:
parent
0e235e5dc6
commit
979099a441
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue