[PATCH] Use pthread_self instead of thr_self on BSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The attached patch uses pthread_self to get the thread ID instead of the non-POSIX thr_self This fixes a compiler warning on FreeBSD.

--
Bruce Cran
diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index fad051f..9da792e 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -2,6 +2,7 @@
 #define FIO_OS_FREEBSD_H

 #include <errno.h>
+#include <pthread.h>
 #include <sys/sysctl.h>
 #include <sys/disk.h>

@@ -54,10 +55,7 @@ static inline unsigned long long os_phys_mem(void)

 static inline int gettid(void)
 {
-       long lwpid;
-
-       thr_self(&lwpid);
-       return (int) lwpid;
+       return (int) pthread_self();
 }

 #ifdef MADV_FREE
diff --git a/os/os-netbsd.h b/os/os-netbsd.h
index 7f5f484..c4a923f 100644
--- a/os/os-netbsd.h
+++ b/os/os-netbsd.h
@@ -2,6 +2,7 @@
 #define FIO_OS_NETBSD_H

 #include <errno.h>
+#include <pthread.h>
 #include <sys/param.h>
 /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
 #define        rb_node _rb_node
@@ -48,10 +49,7 @@ static inline unsigned long long os_phys_mem(void)

 static inline int gettid(void)
 {
-       long lwpid;
-
-       thr_self(&lwpid);
-       return (int) lwpid;
+       return (int) pthread_self();
 }

 #ifdef MADV_FREE

[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux