diff --git a/Makefile b/Makefile index 7f4bee71f682bed28f4e0bf07d670aced0d9fcab..a5b3978109eefbc5d193bc9485e7cc35d2159c45 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 bbff314aa268e592087e00520732e39f0ba33f63..ca41c8dcb3985029097cd1e40c33f0a6efda9f19 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 0000000000000000000000000000000000000000..092606336e6879fc8cde297a3b47bcfc7306b579 --- /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 e54029390da2d9474995fc59400b70e24c3feb73..264543ad7317d3abca13341e73236ceb2d607f8b 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 20e4e07c49d7a95995ee8ab9bf064416f6a5e452..1e908a5ba51fbdb384f45bfcdb2832c2f37d7e30 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>