[sanitizer] Implement GetNumberOfCPUs for Windows
Summary:
Implement `GetNumberOfCPUs` using `GetNativeSystemInfo`.
The only consummer of this function is Scudo which is not functional on
Windows yet.
Reviewers: rnk, zturner
Subscribers: zturner, kubamracek, delcypher, #sanitizers, llvm-commits
@@ -1106,9 +1106,10 @@ bool GetRandom(void *buffer, uptr length, bool blocking) {
UNIMPLEMENTED();
}
-// FIXME: implement on this platform.
u32 GetNumberOfCPUs() {
- UNIMPLEMENTED();
+ SYSTEM_INFO sysinfo = {0};
+ GetNativeSystemInfo(&sysinfo);
+ return sysinfo.dwNumberOfProcessors;
}
} // namespace __sanitizer
