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
|
#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)
|
|||||||
{
|
{
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user