1
1

minor changes on hwloc source files to support windows build.

This commit was SVN r26728.
Этот коммит содержится в:
Shiqing Fan 2012-07-03 12:57:39 +00:00
родитель 98035d131c
Коммит c97f46bcc7
7 изменённых файлов: 31 добавлений и 9 удалений

Просмотреть файл

@ -63,7 +63,6 @@ typedef struct opal_hwloc_base_component_2_0_0_t opal_hwloc_component_t;
MCA_BASE_VERSION_2_0_0, \ MCA_BASE_VERSION_2_0_0, \
"hwloc", 2, 0, 0 "hwloc", 2, 0, 0
END_C_DECLS
/* Define a hierarchical level value that /* Define a hierarchical level value that
* helps resolve the hwloc behavior of * helps resolve the hwloc behavior of
@ -216,4 +215,6 @@ OPAL_DECLSPEC extern bool opal_hwloc_use_hwthreads_as_cpus;
#endif #endif
END_C_DECLS
#endif /* OPAL_HWLOC_H_ */ #endif /* OPAL_HWLOC_H_ */

Просмотреть файл

@ -17,7 +17,9 @@
# include <malloc.h> # include <malloc.h>
#endif #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>

Просмотреть файл

@ -7,7 +7,9 @@
/* Wrapper to avoid msys' tendency to turn / into \ and : into ; */ /* Wrapper to avoid msys' tendency to turn / into \ and : into ; */
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -31,11 +33,20 @@ int main(int argc, char *argv[]) {
if (sscanf(version, "%d:%d:%d", &current, &revision, &age) != 3) if (sscanf(version, "%d:%d:%d", &current, &revision, &age) != 3)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
#ifndef _WIN32
snprintf(name, sizeof(name), "libhwloc-%d", current - age); snprintf(name, sizeof(name), "libhwloc-%d", current - age);
#else
_snprintf(name, sizeof(name), "libhwloc-%d", current - age);
#endif
printf("using soname %s\n", name); printf("using soname %s\n", name);
#ifndef _WIN32
snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s", snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
prog, arch, def, name, lib); prog, arch, def, name, lib);
#else
_snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
prog, arch, def, name, lib);
#endif
if (system(s)) { if (system(s)) {
fprintf(stderr, "%s failed\n", s); fprintf(stderr, "%s failed\n", s);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

Просмотреть файл

@ -14,7 +14,9 @@
#include <limits.h> #include <limits.h>
#include <assert.h> #include <assert.h>
#ifndef _WIN32
#include <strings.h> #include <strings.h>
#endif
/* Read from DESCRIPTION a series of integers describing a symmetrical /* Read from DESCRIPTION a series of integers describing a symmetrical
topology and update `topology->synthetic_description' accordingly. On topology and update `topology->synthetic_description' accordingly. On

Просмотреть файл

@ -307,9 +307,9 @@ hwloc_win_get_thisproc_membind(hwloc_topology_t topology, hwloc_nodeset_t nodese
return hwloc_win_get_proc_membind(topology, GetCurrentProcess(), nodeset, policy, flags); return hwloc_win_get_proc_membind(topology, GetCurrentProcess(), nodeset, policy, flags);
} }
static LPVOID WINAPI (*VirtualAllocExNumaProc)(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect, DWORD nndPreferred); static LPVOID (WINAPI *VirtualAllocExNumaProc)(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect, DWORD nndPreferred);
static BOOL WINAPI (*VirtualFreeExProc)(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType); static BOOL (WINAPI *VirtualFreeExProc)(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
static BOOL WINAPI (*QueryWorkingSetExProc)(HANDLE hProcess, PVOID pv, DWORD cb); static BOOL (WINAPI *QueryWorkingSetExProc)(HANDLE hProcess, PVOID pv, DWORD cb);
static int hwloc_win_get_VirtualAllocExNumaProc(void) { static int hwloc_win_get_VirtualAllocExNumaProc(void) {
if (VirtualAllocExNumaProc == NULL) { if (VirtualAllocExNumaProc == NULL) {
@ -463,10 +463,10 @@ hwloc_win_get_area_membind(hwloc_topology_t topology __hwloc_attribute_unused, c
void void
hwloc_look_windows(struct hwloc_topology *topology) hwloc_look_windows(struct hwloc_topology *topology)
{ {
BOOL WINAPI (*GetLogicalProcessorInformationProc)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnLength); BOOL (WINAPI *GetLogicalProcessorInformationProc)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnLength);
BOOL WINAPI (*GetLogicalProcessorInformationExProc)(LOGICAL_PROCESSOR_RELATIONSHIP relationship, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer, PDWORD ReturnLength); BOOL (WINAPI *GetLogicalProcessorInformationExProc)(LOGICAL_PROCESSOR_RELATIONSHIP relationship, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer, PDWORD ReturnLength);
BOOL WINAPI (*GetNumaAvailableMemoryNodeProc)(UCHAR Node, PULONGLONG AvailableBytes); BOOL (WINAPI *GetNumaAvailableMemoryNodeProc)(UCHAR Node, PULONGLONG AvailableBytes);
BOOL WINAPI (*GetNumaAvailableMemoryNodeExProc)(USHORT Node, PULONGLONG AvailableBytes); BOOL (WINAPI *GetNumaAvailableMemoryNodeExProc)(USHORT Node, PULONGLONG AvailableBytes);
SYSTEM_INFO SystemInfo; SYSTEM_INFO SystemInfo;
DWORD length; DWORD length;

Просмотреть файл

@ -13,7 +13,9 @@
#include <private/debug.h> #include <private/debug.h>
#include <assert.h> #include <assert.h>
#ifndef _WIN32
#include <strings.h> #include <strings.h>
#endif
#ifdef HWLOC_HAVE_LIBXML2 #ifdef HWLOC_HAVE_LIBXML2
#include <libxml/parser.h> #include <libxml/parser.h>

Просмотреть файл

@ -11,8 +11,12 @@
#define _ATFILE_SOURCE #define _ATFILE_SOURCE
#include <assert.h> #include <assert.h>
#include <sys/types.h> #include <sys/types.h>
#ifndef WIN32
#include <dirent.h> #include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>