From 6943fb3aed8bf23681f7cb0277667c33098a3b07 Mon Sep 17 00:00:00 2001
From: Jan Tattermusch <jtattermusch@google.com>
Date: Mon, 9 Feb 2015 17:38:52 -0800
Subject: [PATCH] added cpu_windows.c

---
 Makefile                              |  2 ++
 build.json                            |  1 +
 src/core/support/cpu_windows.c        | 52 +++++++++++++++++++++++++++
 vsprojects/vs2013/gpr.vcxproj         |  2 ++
 vsprojects/vs2013/gpr.vcxproj.filters |  3 ++
 5 files changed, 60 insertions(+)
 create mode 100644 src/core/support/cpu_windows.c

diff --git a/Makefile b/Makefile
index 7f4bee71f6..a5b3978109 100644
--- a/Makefile
+++ b/Makefile
@@ -1684,6 +1684,7 @@ LIBGPR_SRC = \
     src/core/support/cmdline.c \
     src/core/support/cpu_linux.c \
     src/core/support/cpu_posix.c \
+    src/core/support/cpu_windows.c \
     src/core/support/env_linux.c \
     src/core/support/env_posix.c \
     src/core/support/env_win32.c \
@@ -1776,6 +1777,7 @@ objs/$(CONFIG)/src/core/support/cancellable.o:
 objs/$(CONFIG)/src/core/support/cmdline.o: 
 objs/$(CONFIG)/src/core/support/cpu_linux.o: 
 objs/$(CONFIG)/src/core/support/cpu_posix.o: 
+objs/$(CONFIG)/src/core/support/cpu_windows.o: 
 objs/$(CONFIG)/src/core/support/env_linux.o: 
 objs/$(CONFIG)/src/core/support/env_posix.o: 
 objs/$(CONFIG)/src/core/support/env_win32.o: 
diff --git a/build.json b/build.json
index bbff314aa2..ca41c8dcb3 100644
--- a/build.json
+++ b/build.json
@@ -252,6 +252,7 @@
         "src/core/support/cmdline.c",
         "src/core/support/cpu_linux.c",
         "src/core/support/cpu_posix.c",
+        "src/core/support/cpu_windows.c",
         "src/core/support/env_linux.c",
         "src/core/support/env_posix.c",
         "src/core/support/env_win32.c",
diff --git a/src/core/support/cpu_windows.c b/src/core/support/cpu_windows.c
new file mode 100644
index 0000000000..092606336e
--- /dev/null
+++ b/src/core/support/cpu_windows.c
@@ -0,0 +1,52 @@
+/*
+*
+* Copyright 2014, Google Inc.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+*     * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*     * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following disclaimer
+* in the documentation and/or other materials provided with the
+* distribution.
+*     * Neither the name of Google Inc. nor the names of its
+* contributors may be used to endorse or promote products derived from
+* this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_WIN32
+
+#include "src/core/support/cpu.h"
+
+#include <grpc/support/log.h>
+
+unsigned gpr_cpu_num_cores(void) {
+  /* TODO: implement */
+  return 1;
+}
+
+unsigned gpr_cpu_current_cpu(void) {
+  /* TODO: implement */
+  return 1;
+}
+
+#endif /* GPR_WIN32 */
diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj
index e54029390d..264543ad73 100644
--- a/vsprojects/vs2013/gpr.vcxproj
+++ b/vsprojects/vs2013/gpr.vcxproj
@@ -115,6 +115,8 @@
     </ClCompile>
     <ClCompile Include="..\..\src\core\support\cpu_posix.c">
     </ClCompile>
+    <ClCompile Include="..\..\src\core\support\cpu_windows.c">
+    </ClCompile>
     <ClCompile Include="..\..\src\core\support\env_linux.c">
     </ClCompile>
     <ClCompile Include="..\..\src\core\support\env_posix.c">
diff --git a/vsprojects/vs2013/gpr.vcxproj.filters b/vsprojects/vs2013/gpr.vcxproj.filters
index 20e4e07c49..1e908a5ba5 100644
--- a/vsprojects/vs2013/gpr.vcxproj.filters
+++ b/vsprojects/vs2013/gpr.vcxproj.filters
@@ -16,6 +16,9 @@
     <ClCompile Include="..\..\src\core\support\cpu_posix.c">
       <Filter>src\core\support</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\core\support\cpu_windows.c">
+      <Filter>src\core\support</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\src\core\support\env_linux.c">
       <Filter>src\core\support</Filter>
     </ClCompile>
-- 
GitLab