Skip to content

Commit 34cca80

Browse files
committed
Fix build on kFreeBSD/GNU
which does not seem to have have sys/thr.h installed. Signed-off-by: Samuel Thibault <[email protected]>
1 parent 5de58da commit 34cca80

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

config/hwloc.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ EOF])
436436
if test x$hwloc_freebsd = xyes; then
437437
438438
AC_CHECK_HEADERS([sys/domainset.h])
439+
AC_CHECK_HEADERS([sys/thr.h])
439440
440441
fi
441442

hwloc/topology-freebsd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#include <pthread.h>
1717
#include <sys/cdefs.h>
1818
#include <stddef.h>
19+
#ifdef HAVE_SYS_THR_H
1920
#include <sys/thr.h>
21+
#endif
2022
#ifdef HAVE_PTHREAD_NP_H
2123
#include <pthread_np.h>
2224
#endif
@@ -345,6 +347,7 @@ hwloc_freebsd_get_proc_last_cpu_location(hwloc_topology_t topology __hwloc_attri
345347
return hwloc_freebsd_get_last_cpu_location(name, set, 0);
346348
}
347349

350+
#ifdef HAVE_SYS_THR_H
348351
static int
349352
hwloc_freebsd_get_thisthread_last_cpu_location(hwloc_topology_t topology __hwloc_attribute_unused, hwloc_cpuset_t set, int flags __hwloc_attribute_unused) {
350353
long thr_id;
@@ -359,6 +362,7 @@ hwloc_freebsd_get_thisthread_last_cpu_location(hwloc_topology_t topology __hwloc
359362
name[3] = getpid();
360363
return hwloc_freebsd_get_last_cpu_location(name, set, thr_id);
361364
}
365+
#endif
362366

363367
static int
364368
set_locality_info(hwloc_topology_t topology, int ndomains, hwloc_obj_t *nodes){
@@ -573,7 +577,9 @@ hwloc_set_freebsd_hooks(struct hwloc_binding_hooks *hooks __hwloc_attribute_unus
573577
#endif
574578
hooks->get_thisproc_last_cpu_location = hwloc_freebsd_get_thisproc_last_cpu_location;
575579
hooks->get_proc_last_cpu_location = hwloc_freebsd_get_proc_last_cpu_location;
580+
#ifdef HAVE_SYS_THR_H
576581
hooks->get_thisthread_last_cpu_location = hwloc_freebsd_get_thisthread_last_cpu_location;
582+
#endif
577583
}
578584

579585
static struct hwloc_backend *

tests/hwloc/ports/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright © 2009-2020 Inria. All rights reserved.
2-
# Copyright © 2009, 2011-2012 Université Bordeaux
2+
# Copyright © 2009, 2011-2012, 2020 Université Bordeaux
33
# Copyright © 2009-2014 Cisco Systems, Inc. All rights reserved.
44
# See COPYING in top-level directory.
55

@@ -90,7 +90,8 @@ libhwloc_port_freebsd_la_CPPFLAGS = $(common_CPPFLAGS) \
9090
-DHAVE_DECL_PTHREAD_SETAFFINITY_NP=1 \
9191
-DHAVE_DECL_PTHREAD_GETAFFINITY_NP=1 \
9292
-DHAVE_CPUSET_SETID \
93-
-DHAVE_SYS_DOMAINSET_H
93+
-DHAVE_SYS_DOMAINSET_H \
94+
-DHAVE_SYS_THR_H
9495

9596
nodist_libhwloc_port_hpux_la_SOURCES = topology-hpux.c
9697
libhwloc_port_hpux_la_SOURCES = \

0 commit comments

Comments
 (0)