]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/libcephfs: introduce (uint64_t)ceph_pthread_self() 30505/head
authorWillem Jan Withagen <wjw@digiware.nl>
Sat, 21 Sep 2019 12:51:06 +0000 (14:51 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Fri, 27 Sep 2019 19:59:09 +0000 (21:59 +0200)
There is a  difference between libc shipped with FreeBSD and
glibc shipped with GNU/Linux for the return type of pthread_self().

Introduced a conversion function in include/compat.h
    (uint64_t)ceph_pthread_self()

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/test/libcephfs/ceph_pthread_self.h [new file with mode: 0644]
src/test/libcephfs/flock.cc
src/test/libcephfs/recordlock.cc

diff --git a/src/test/libcephfs/ceph_pthread_self.h b/src/test/libcephfs/ceph_pthread_self.h
new file mode 100644 (file)
index 0000000..4c0c98f
--- /dev/null
@@ -0,0 +1,31 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_TEST_LIBCEPHFS_PTHREAD_SELF
+#define CEPH_TEST_LIBCEPHFS_PTHREAD_SELF
+
+#include <pthread.h>
+
+#include <type_traits>
+
+/*
+ * There is a  difference between libc shipped with FreeBSD and
+ * glibc shipped with GNU/Linux for the return type of pthread_self().
+ *
+ * Introduced a conversion function in include/compat.h
+ *     (uint64_t)ceph_pthread_self()
+ *
+ * libc returns an opague pthread_t that is not default convertable
+ * to a uint64_t, which is what gtest expects.
+ * And tests using gtest will not compile because of this difference.
+ * 
+ */
+static uint64_t ceph_pthread_self() {
+  auto me = pthread_self();
+  static_assert(std::is_convertible_v<decltype(me), uint64_t> ||
+                std::is_pointer_v<decltype(me)>,
+                "we need to use pthread_self() for the owner parameter");
+  return reinterpret_cast<uint64_t>(me);
+}
+
+#endif
index 79f8a0777ade565e1c0f750cf9ce16c5577bbd50..9add019d37ae915737953ecc1dc9f23809bdb539 100644 (file)
@@ -26,8 +26,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
-#include <sys/xattr.h>
-
 #include <stdlib.h>
 #include <semaphore.h>
 #include <time.h>
 
 #ifdef __linux__
 #include <limits.h>
+#include <sys/xattr.h>
+#elif __FreeBSD__
+#include <sys/types.h>
+#include <sys/wait.h>
 #endif
 
 #include "include/ceph_assert.h"
+#include "ceph_pthread_self.h"
 
 // Startup common: create and mount ceph fs
 #define STARTUP_CEPH() do {                            \
@@ -175,27 +178,27 @@ static void thread_ConcurrentLocking(str_ConcurrentLocking& s) {
   ASSERT_GE(fd, 0); 
 
   ASSERT_EQ(-EWOULDBLOCK,
-           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self()));
+           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self()));
   PING_MAIN(1); // (1)
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self()));
   PING_MAIN(2); // (2)
 
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
   PING_MAIN(3); // (3)
 
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH, ceph_pthread_self()));
   PING_MAIN(4); // (4)
 
   WAIT_MAIN(1); // (R1)
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
   PING_MAIN(5); // (5)
 
   WAIT_MAIN(2); // (R2)
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self()));
   PING_MAIN(6); // (6)
 
   WAIT_MAIN(3); // (R3)
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
   PING_MAIN(7); // (7)
 }
 
@@ -218,7 +221,7 @@ TEST(LibCephFS, ConcurrentLocking) {
   ASSERT_GE(fd, 0); 
 
   // Lock
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self()));
 
   // Start locker thread
   pthread_t thread;
@@ -233,7 +236,7 @@ TEST(LibCephFS, ConcurrentLocking) {
   NOT_WAIT_WORKER(2); // (2)
 
   // Unlock
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
 
   // Shall have lock
   // Synchronization point with thread (failure: thread is dead)
@@ -245,8 +248,8 @@ TEST(LibCephFS, ConcurrentLocking) {
   // Wait for thread to share lock
   WAIT_WORKER(4); // (4)
   ASSERT_EQ(-EWOULDBLOCK,
-           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self()));
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self()));
+           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self()));
 
   // Wake up thread to unlock shared lock
   PING_WORKER(1); // (R1)
@@ -254,7 +257,7 @@ TEST(LibCephFS, ConcurrentLocking) {
 
   // Now we can lock exclusively
   // Upgrade to exclusive lock (as per POSIX)
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self()));
 
   // Wake up thread to lock shared lock
   PING_WORKER(2); // (R2)
@@ -263,22 +266,22 @@ TEST(LibCephFS, ConcurrentLocking) {
   NOT_WAIT_WORKER(6); // (6)
 
   // Release lock ; thread will get it
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
   WAIT_WORKER(6); // (6)
 
   // We no longer have the lock
   ASSERT_EQ(-EWOULDBLOCK,
-           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self()));
+           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self()));
   ASSERT_EQ(-EWOULDBLOCK,
-           ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self()));
+           ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self()));
 
   // Wake up thread to unlock exclusive lock
   PING_WORKER(3); // (R3)
   WAIT_WORKER(7); // (7)
 
   // We can lock it again
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self()));
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
 
   // Cleanup
   void *retval = (void*) (uintptr_t) -1;
@@ -301,7 +304,7 @@ TEST(LibCephFS, ThreesomeLocking) {
   ASSERT_GE(fd, 0); 
 
   // Lock
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self()));
 
   // Start locker thread
   pthread_t thread[2];
@@ -317,7 +320,7 @@ TEST(LibCephFS, ThreesomeLocking) {
   NOT_WAIT_WORKER(2); // (2)
 
   // Unlock
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
 
   // Shall have lock
   TWICE(// Synchronization point with thread (failure: thread is dead)
@@ -329,8 +332,8 @@ TEST(LibCephFS, ThreesomeLocking) {
   // Wait for thread to share lock
   TWICE(WAIT_WORKER(4)); // (4)
   ASSERT_EQ(-EWOULDBLOCK,
-           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self()));
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self()));
+           ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self()));
 
   // Wake up thread to unlock shared lock
   TWICE(PING_WORKER(1); // (R1)
@@ -338,7 +341,7 @@ TEST(LibCephFS, ThreesomeLocking) {
 
   // Now we can lock exclusively
   // Upgrade to exclusive lock (as per POSIX)
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX, ceph_pthread_self()));
 
   TWICE(  // Wake up thread to lock shared lock
        PING_WORKER(2); // (R2)
@@ -347,14 +350,14 @@ TEST(LibCephFS, ThreesomeLocking) {
        NOT_WAIT_WORKER(6)); // (6)
   
   // Release lock ; thread will get it
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
   TWICE(WAIT_WORKER(6); // (6)
        
        // We no longer have the lock
        ASSERT_EQ(-EWOULDBLOCK,
-                 ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self()));
+                 ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self()));
        ASSERT_EQ(-EWOULDBLOCK,
-                 ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, pthread_self()));
+                 ceph_flock(cmount, fd, LOCK_SH | LOCK_NB, ceph_pthread_self()));
        
        // Wake up thread to unlock exclusive lock
        PING_WORKER(3); // (R3)
@@ -362,8 +365,8 @@ TEST(LibCephFS, ThreesomeLocking) {
        );
   
   // We can lock it again
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, pthread_self()));
-  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_EX | LOCK_NB, ceph_pthread_self()));
+  ASSERT_EQ(0, ceph_flock(cmount, fd, LOCK_UN, ceph_pthread_self()));
 
   // Cleanup
   void *retval = (void*) (uintptr_t) -1;
index 9d1fcdede8b9ede7c6c9b8b9361fb2bc24a93702..efcfc6aab5c3fe102c4e20879a7a793fbc741f47 100644 (file)
@@ -27,7 +27,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
-#include <sys/xattr.h>
 
 #include <stdlib.h>
 #include <semaphore.h>
 
 #ifdef __linux__
 #include <limits.h>
+#include <sys/xattr.h>
+#elif __FreeBSD__
+#include <sys/types.h>
+#include <sys/wait.h>
 #endif
 
 #include "include/ceph_assert.h"
+#include "ceph_pthread_self.h"
 
 // Startup common: create and mount ceph fs
 #define STARTUP_CEPH() do {                            \
@@ -304,7 +308,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   PING_MAIN(1); // (1)
   lock1.l_type = F_WRLCK;
@@ -312,7 +316,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true));
   PING_MAIN(2); // (2)
 
   lock1.l_type = F_UNLCK;
@@ -320,7 +324,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   PING_MAIN(3); // (3)
 
   lock1.l_type = F_RDLCK;
@@ -328,7 +332,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true));
   PING_MAIN(4); // (4)
 
   WAIT_MAIN(1); // (R1)
@@ -337,7 +341,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   PING_MAIN(5); // (5)
 
   WAIT_MAIN(2); // (R2)
@@ -346,7 +350,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true));
   PING_MAIN(6); // (6)
 
   WAIT_MAIN(3); // (R3)
@@ -355,7 +359,7 @@ static void thread_ConcurrentRecordLocking(str_ConcurrentRecordLocking& s) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   PING_MAIN(7); // (7)
 
   ASSERT_EQ(0, ceph_ll_close(cmount, fh));
@@ -398,7 +402,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true));
 
   // Start locker thread
   pthread_t thread;
@@ -418,7 +422,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   // Shall have lock
   // Synchronization point with thread (failure: thread is dead)
@@ -434,13 +438,13 @@ TEST(LibCephFS, ConcurrentRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   lock1.l_type = F_RDLCK;
   lock1.l_whence = SEEK_SET;
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   // Wake up thread to unlock shared lock
   PING_WORKER(1); // (R1)
@@ -453,7 +457,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true));
 
   // Wake up thread to lock shared lock
   PING_WORKER(2); // (R2)
@@ -467,7 +471,7 @@ TEST(LibCephFS, ConcurrentRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   WAIT_WORKER(6); // (6)
 
   // We no longer have the lock
@@ -476,13 +480,13 @@ TEST(LibCephFS, ConcurrentRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   lock1.l_type = F_RDLCK;
   lock1.l_whence = SEEK_SET;
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   // Wake up thread to unlock exclusive lock
   PING_WORKER(3); // (R3)
@@ -494,13 +498,13 @@ TEST(LibCephFS, ConcurrentRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   lock1.l_type = F_UNLCK;
   lock1.l_whence = SEEK_SET;
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   // Cleanup
   void *retval = (void*) (uintptr_t) -1;
@@ -541,7 +545,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true));
 
   // Start locker thread
   pthread_t thread[2];
@@ -562,7 +566,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   // Shall have lock
   TWICE(// Synchronization point with thread (failure: thread is dead)
@@ -578,13 +582,13 @@ TEST(LibCephFS, ThreesomeRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   lock1.l_type = F_RDLCK;
   lock1.l_whence = SEEK_SET;
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   // Wake up thread to unlock shared lock
   TWICE(PING_WORKER(1); // (R1)
@@ -597,7 +601,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), true));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), true));
 
   TWICE(  // Wake up thread to lock shared lock
        PING_WORKER(2); // (R2)
@@ -611,7 +615,7 @@ TEST(LibCephFS, ThreesomeRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   TWICE(WAIT_WORKER(6); // (6)
        
        // We no longer have the lock
@@ -620,13 +624,13 @@ TEST(LibCephFS, ThreesomeRecordLocking) {
        lock1.l_start = 0;
        lock1.l_len = 1024;
        lock1.l_pid = getpid();
-       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
        lock1.l_type = F_RDLCK;
        lock1.l_whence = SEEK_SET;
        lock1.l_start = 0;
        lock1.l_len = 1024;
        lock1.l_pid = getpid();
-       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
        
        // Wake up thread to unlock exclusive lock
        PING_WORKER(3); // (R3)
@@ -639,13 +643,13 @@ TEST(LibCephFS, ThreesomeRecordLocking) {
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
   lock1.l_type = F_UNLCK;
   lock1.l_whence = SEEK_SET;
   lock1.l_start = 0;
   lock1.l_len = 1024;
   lock1.l_pid = getpid();
-  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+  ASSERT_EQ(0, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
 
   // Cleanup
   void *retval = (void*) (uintptr_t) -1;
@@ -1049,13 +1053,13 @@ TEST(LibCephFS, DISABLED_ThreesomeInterProcessRecordLocking) {
        lock1.l_start = 0;
        lock1.l_len = 1024;
        lock1.l_pid = getpid();
-       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
        lock1.l_type = F_RDLCK;
        lock1.l_whence = SEEK_SET;
        lock1.l_start = 0;
        lock1.l_len = 1024;
        lock1.l_pid = getpid();
-       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, pthread_self(), false));
+       ASSERT_EQ(-EAGAIN, ceph_ll_setlk(cmount, fh, &lock1, ceph_pthread_self(), false));
        
        // Wake up process to unlock exclusive lock
        PING_WORKER(4); // (R4)