Add patch for GetNumaProcessorNode.

This commit is contained in:
Michael Müller 2014-10-18 06:03:40 +02:00
parent e63ff1be87
commit d3d40b651b
4 changed files with 205 additions and 0 deletions

View File

@ -35,6 +35,7 @@ PATCHLIST := \
iphlpapi-TCP_Table.ok \
kernel32-FindFirstFile.ok \
kernel32-GetFinalPathNameByHandle.ok \
kernel32-GetNumaProcessorNode.ok \
kernel32-GetSystemTimes.ok \
kernel32-GetVolumePathName.ok \
kernel32-Named_Pipe.ok \
@ -468,6 +469,23 @@ kernel32-GetFinalPathNameByHandle.ok:
echo '+ { "kernel32-GetFinalPathNameByHandle", "Michael Müller", "Implement GetFinalPathNameByHandle in kernel32." },'; \
) > kernel32-GetFinalPathNameByHandle.ok
# Patchset kernel32-GetNumaProcessorNode
# |
# | Included patches:
# | * Implement GetNumaProcessorNode. [by Michael Müller]
# |
# | Modified files:
# | * dlls/kernel32/cpu.c, dlls/kernel32/kernel32.spec, dlls/kernel32/tests/Makefile.in, dlls/kernel32/tests/cpu.c,
# | include/winbase.h
# |
.INTERMEDIATE: kernel32-GetNumaProcessorNode.ok
kernel32-GetNumaProcessorNode.ok:
$(call APPLY_FILE,kernel32-GetNumaProcessorNode/0001-kernel32-Implement-GetNumaProcessorNode.patch)
$(call APPLY_FILE,kernel32-GetNumaProcessorNode/0002-kernel32-tests-Add-tests-for-GetNumaProcessorNode.patch)
@( \
echo '+ { "kernel32-GetNumaProcessorNode", "Michael Müller", "Implement GetNumaProcessorNode." },'; \
) > kernel32-GetNumaProcessorNode.ok
# Patchset kernel32-GetSystemTimes
# |
# | Included patches:

View File

@ -0,0 +1,75 @@
From 2f474554aacbbf9980c1294fe26ac2fd77df85d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 18 Oct 2014 05:57:32 +0200
Subject: kernel32: Implement GetNumaProcessorNode.
---
dlls/kernel32/cpu.c | 28 ++++++++++++++++++++++++++++
dlls/kernel32/kernel32.spec | 2 +-
include/winbase.h | 1 +
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index 0ebf8f3..c389898 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -229,3 +229,31 @@ BOOL WINAPI K32GetPerformanceInfo(PPERFORMANCE_INFORMATION info, DWORD size)
}
return TRUE;
}
+
+/***********************************************************************
+ * GetNumaProcessorNode (KERNEL32.@)
+ */
+BOOL WINAPI GetNumaProcessorNode(UCHAR processor, PUCHAR node)
+{
+ SYSTEM_INFO si;
+
+ TRACE( "(%d, %p)\n", processor, node );
+
+ if (!node)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ GetSystemInfo(&si);
+
+ if (processor < si.dwNumberOfProcessors)
+ {
+ *node = 0;
+ return TRUE;
+ }
+
+ *node = 0xFF;
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+}
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index d08f90c..3de8e57 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -584,7 +584,7 @@
@ stdcall GetNumaHighestNodeNumber(ptr)
@ stdcall GetNumaNodeProcessorMask(long ptr)
# @ stub GetNumaProcessorMap
-# @ stub GetNumaProcessorNode
+@ stdcall GetNumaProcessorNode(long ptr)
@ stdcall GetNumberFormatA(long long str ptr ptr long)
@ stdcall GetNumberFormatW(long long wstr ptr ptr long)
@ stub GetNumberOfConsoleFonts
diff --git a/include/winbase.h b/include/winbase.h
index edd6ad6..055dd00 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1939,6 +1939,7 @@ WINBASEAPI BOOL WINAPI GetNamedPipeHandleStateW(HANDLE,LPDWORD,LPDWORD,LP
#define GetNamedPipeHandleState WINELIB_NAME_AW(GetNamedPipeHandleState)
WINBASEAPI BOOL WINAPI GetNamedPipeInfo(HANDLE,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
WINBASEAPI VOID WINAPI GetNativeSystemInfo(LPSYSTEM_INFO);
+WINBASEAPI BOOL WINAPI GetNumaProcessorNode(UCHAR, PUCHAR);
WINADVAPI BOOL WINAPI GetNumberOfEventLogRecords(HANDLE,PDWORD);
WINADVAPI BOOL WINAPI GetOldestEventLogRecord(HANDLE,PDWORD);
WINBASEAPI BOOL WINAPI GetOverlappedResult(HANDLE,LPOVERLAPPED,LPDWORD,BOOL);
--
1.9.1

View File

@ -0,0 +1,109 @@
From 24212987a7f995c9219be5807c6d70bd5d0f6f2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 18 Oct 2014 06:00:48 +0200
Subject: kernel32/tests: Add tests for GetNumaProcessorNode.
---
dlls/kernel32/tests/Makefile.in | 1 +
dlls/kernel32/tests/cpu.c | 77 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+)
create mode 100644 dlls/kernel32/tests/cpu.c
diff --git a/dlls/kernel32/tests/Makefile.in b/dlls/kernel32/tests/Makefile.in
index 2f2ac5f..50b0d8d 100644
--- a/dlls/kernel32/tests/Makefile.in
+++ b/dlls/kernel32/tests/Makefile.in
@@ -8,6 +8,7 @@ C_SRCS = \
codepage.c \
comm.c \
console.c \
+ cpu.c \
debugger.c \
directory.c \
drive.c \
diff --git a/dlls/kernel32/tests/cpu.c b/dlls/kernel32/tests/cpu.c
new file mode 100644
index 0000000..405d990
--- /dev/null
+++ b/dlls/kernel32/tests/cpu.c
@@ -0,0 +1,77 @@
+/*
+ * Unit test suite for cpu functions
+ *
+ * Copyright 2014 Michael Müller
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/test.h"
+#include "winbase.h"
+#include "winnls.h"
+
+static BOOL (WINAPI *pGetNumaProcessorNode)(UCHAR, PUCHAR);
+
+static void InitFunctionPointers(void)
+{
+ HMODULE hkernel32 = GetModuleHandleA("kernel32");
+
+ pGetNumaProcessorNode = (void *)GetProcAddress(hkernel32, "GetNumaProcessorNode");
+}
+
+static void test_GetNumaProcessorNode(void)
+{
+ SYSTEM_INFO si;
+ UCHAR node;
+ BOOL ret;
+ int i;
+
+ if (!pGetNumaProcessorNode)
+ {
+ win_skip("GetNumaProcessorNode() is missing\n");
+ return;
+ }
+
+ GetSystemInfo(&si);
+
+ for (i = 0; i < 256; i++)
+ {
+ ret = pGetNumaProcessorNode(i, &node);
+ if (i < si.dwNumberOfProcessors)
+ {
+ ok(ret, "expected TRUE, got FALSE for processor %d\n", i);
+ ok(node != 0xFF, "expected node != 0xFF, but got 0xFF\n");
+ }
+ else
+ {
+ ok(!ret, "expected FALSE, got TRUE for processor %d\n", i);
+ ok(node == 0xFF, "expected node == 0xFF, but got %x\n", node);
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ }
+ }
+
+ /* crashes on windows */
+ if (0)
+ {
+ ok(!pGetNumaProcessorNode(0, NULL), "expected return value FALSE, got TRUE\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ }
+}
+
+START_TEST(cpu)
+{
+ InitFunctionPointers();
+ test_GetNumaProcessorNode();
+}
--
1.9.1

View File

@ -0,0 +1,3 @@
Author: Michael Müller
Subject: Implement GetNumaProcessorNode.
Revision: 1