Re: [PATCH] Use pthread_self instead of thr_self on BSD

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

 



On 2011-07-30 13:17, Bruce Cran wrote:
> On 30/07/2011 11:55, Jens Axboe wrote:
>> On 2011-07-30 11:43, Bruce Cran wrote:
>>> 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.
>> Does pthread_self() return a thread ID in the PID name space, so to
>> speak?
>>
> 
> Hmm no, it doesn't seem to. In that case <sys/thr.h> should probably be 
> included to get the definition of thr_self().

I suspected as much, most OS' will return a unique ID but not something
you can otherwise use. How about the below?

diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index fad051f..317d403 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -4,6 +4,7 @@
 #include <errno.h>
 #include <sys/sysctl.h>
 #include <sys/disk.h>
+#include <sys/thr.h>
 
 #include "../file.h"
 
diff --git a/os/os-netbsd.h b/os/os-netbsd.h
index 7f5f484..e03866d 100644
--- a/os/os-netbsd.h
+++ b/os/os-netbsd.h
@@ -3,6 +3,7 @@
 
 #include <errno.h>
 #include <sys/param.h>
+#include <sys/thr.h>
 /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
 #define	rb_node	_rb_node
 #include <sys/sysctl.h>

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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