Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix FreeBSD builds
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 16 Jan 2019 07:14:49 +0000 (08:14 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 16 Jan 2019 07:14:49 +0000 (08:14 +0100)
CMakeLists.txt
src/include/xbt/parmap.hpp
src/internal_config.h.in

index 3e61006..be9a190 100644 (file)
@@ -286,6 +286,7 @@ endif()
 # Checks for header libraries functions.
 CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
 CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np  "" HAVE_PTHREAD_SETAFFINITY)
+CHECK_INCLUDE_FILE("pthread_np" HAVE_PTHREAD_NP_H) # for pthread_setaffinity_np() on FreeBSD
 
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
   set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
index e28e78a..f2360eb 100644 (file)
 #include <sys/syscall.h>
 #endif
 
+#if HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+
 XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap);
 
 namespace simgrid {
index c32f594..8541070 100644 (file)
 #cmakedefine01 HAVE_UCONTEXT_CONTEXTS
 
 /* Variables for the thread contexts (and parallel mode of raw contexts) */
-/* Does not seems defined on Mac nor Windows */
+/* pthread_setaffinity_np() is Linux and FreeBSD but not on Mac nor Windows */
 #cmakedefine01 HAVE_PTHREAD_SETAFFINITY
+/* pthread_setaffinity_np() defined in pthread_np.h on FreeBSD but not Linux */
+#cmakedefine01 HAVE_PTHREAD_NP_H
 
 /* Variables for the raw contexts (to select the right assembly code) */
 #cmakedefine01 SIMGRID_PROCESSOR_i686