[compiler-rt] r323462 - [sanitizer] Implement GetNumberOfCPUs for Windows

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 12:14:35 PST 2018


Author: cryptoad
Date: Thu Jan 25 12:14:35 2018
New Revision: 323462

URL: http://llvm.org/viewvc/llvm-project?rev=323462&view=rev
Log:
[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

Reviewed By: zturner

Subscribers: zturner, kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D42547

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=323462&r1=323461&r2=323462&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Thu Jan 25 12:14:35 2018
@@ -1106,9 +1106,10 @@ bool GetRandom(void *buffer, uptr length
   UNIMPLEMENTED();
 }
 
-// FIXME: implement on this platform.
 u32 GetNumberOfCPUs() {
-  UNIMPLEMENTED();
+  SYSTEM_INFO sysinfo = {0};
+  GetNativeSystemInfo(&sysinfo);
+  return sysinfo.dwNumberOfProcessors;
 }
 
 }  // namespace __sanitizer




More information about the llvm-commits mailing list