Skip to content

Commit 0a67b7d

Browse files
ndenoyelleNicolasDenoyelle
authored andcommitted
add tool and tests for binding threads according to a set of locations
1 parent c53f1b5 commit 0a67b7d

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

config/hwloc_internal.m4

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,34 @@ EOF
338338
AC_CHECK_FUNCS([clock_gettime])
339339
])
340340
341+
# Check for ptrace support
342+
hwloc_have_ptrace=1
343+
AC_CHECK_HEADERS([sys/ptrace.h],, [hwloc_have_ptrace=0])
344+
AC_CHECK_FUNCS([ptrace],, [hwloc_have_ptrace=0])
345+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
346+
#include "sys/ptrace.h"
347+
int main(void){
348+
return ptrace(PTRACE_SEIZE,
349+
-1,
350+
0,
351+
(void*)(PTRACE_O_TRACECLONE|PTRACE_O_TRACEFORK));
352+
}
353+
]])],, [hwloc_have_ptrace=0])
354+
AM_CONDITIONAL([HWLOC_HAVE_PTRACE],[test $hwloc_have_ptrace -eq 1])
355+
AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTRACE], [$hwloc_have_ptrace], [Whether ptrace is present and supports PTRACE_SEIZE or not])
356+
357+
# Check if syscall gettid is available.
358+
hwloc_have_sys_gettid=1
359+
AC_CHECK_HEADERS([sys/syscall.h],, [hwloc_have_sys_gettid=0])
360+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
361+
#include "sys/syscall.h"
362+
#ifndef SYS_gettid
363+
#error "syscall SYS_gettid not found"
364+
#endif
365+
int main(void){ return syscall(SYS_gettid) > 0;}
366+
]])],,[hwloc_have_sys_gettid=0])
367+
AC_DEFINE_UNQUOTED([HWLOC_HAVE_SYS_GETTID], [$hwloc_have_sys_gettid], [Whether syscall header is present and SYS_gettid macro is defined or not])
368+
341369
# Only generate this if we're building the utilities
342370
# Even the netloc library Makefile is here because
343371
# we don't embed libnetloc yet, it's useless without tools
@@ -368,7 +396,11 @@ AC_DEFUN([HWLOC_SETUP_TESTS],[
368396
###
369397
EOF
370398
371-
AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes])
399+
# Check thread support.
400+
AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=1], [hwloc_have_pthread=0])
401+
AC_DEFINE_UNQUOTED([HWLOC_HAVE_PTHREAD], [$hwloc_have_pthread], [Whether we have the pthread library or not])
402+
AM_CONDITIONAL([HWLOC_HAVE_PTHREAD], [test $hwloc_have_pthread -eq 1]) AC_CHECK_LIB([pthread], [pthread_self], [hwloc_have_pthread=yes])
403+
AC_OPENMP
372404
373405
HWLOC_PKG_CHECK_MODULES([NUMA], [numa], [numa_available], [numa.h],
374406
[hwloc_have_linux_libnuma=yes],

0 commit comments

Comments
 (0)