]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
core: make pthread_get_name_np work when available 23641/head
authorWillem Jan Withagen <wjw@digiware.nl>
Sun, 19 Aug 2018 00:47:54 +0000 (02:47 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Sun, 19 Aug 2018 10:07:56 +0000 (12:07 +0200)
FreeBSD will have a pthread_get_name_np() in libpthread
Code for that was submitted

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
CMakeLists.txt
src/include/compat.h

index d9ec6bc4dd68e57287b441fb96e22637407f19fc..8142f17d5a19ff8ab52e6fbf0188779623c6b310 100644 (file)
@@ -104,6 +104,7 @@ cmake_push_check_state(RESET)
 set(CMAKE_REQUIRED_LIBRARIES pthread)
 CHECK_FUNCTION_EXISTS(pthread_spin_init HAVE_PTHREAD_SPINLOCK)
 CHECK_FUNCTION_EXISTS(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
+CHECK_FUNCTION_EXISTS(pthread_get_name_np HAVE_PTHREAD_GET_NAME_NP)
 CHECK_FUNCTION_EXISTS(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
 CHECK_FUNCTION_EXISTS(pthread_getname_np HAVE_PTHREAD_GETNAME_NP)
 CHECK_FUNCTION_EXISTS(pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
index 06b4b127a7ecdd3d2ce7455946beb2d28f4a8df5..b6c629b7e03dd9bb8250cf75946e53c699c5a53e 100644 (file)
 
 #if defined(HAVE_PTHREAD_GETNAME_NP)
   #define ceph_pthread_getname pthread_getname_np
+#elif defined(HAVE_PTHREAD_GET_NAME_NP)
+  #define ceph_pthread_getname(thread, name, len) ({ \
+    pthread_get_name_np(thread, name, len);          \
+    0; })
 #else
   /* compiler warning free success noop */
   #define ceph_pthread_getname(thread, name, len) ({ \