summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2012-05-08 12:10:59 +0100
committerPete Batard <pete@akeo.ie>2012-05-08 12:10:59 +0100
commit6d47fa1bc52562f673c30e5fd36f8ae44ed102e8 (patch)
tree862e02d57dbe49edb18a07d52109fa3a56d1efbd
parent00d6fed8f26418b00ab9177d67d53af7328ec127 (diff)
downloadlibusbx-6d47fa1bc52562f673c30e5fd36f8ae44ed102e8.tar.gz
BSD: Add thread ID support for OpenBSD > 5.1
* Uses syscall(SYS_getthrid) which requires real thread support, currently only available in 5.1-current (but not 5.1-release). For OpenBSD <= 5.1, -1 will be returned for the thread ID.
-rw-r--r--libusb/os/threads_posix.c8
-rw-r--r--libusb/version.h2
2 files changed, 7 insertions, 3 deletions
diff --git a/libusb/os/threads_posix.c b/libusb/os/threads_posix.c
index 8e9b490..20f279a 100644
--- a/libusb/os/threads_posix.c
+++ b/libusb/os/threads_posix.c
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if defined(__linux__)
+#if defined(__linux__) || defined(__OpenBSD__)
# include <unistd.h>
# include <sys/syscall.h>
#elif defined(__APPLE__)
@@ -66,10 +66,14 @@ int usbi_get_tid(void)
int ret = -1;
#if defined(__linux__)
ret = syscall(SYS_gettid);
+#elif defined(__OpenBSD__)
+ /* The following only works with OpenBSD > 5.1 as it requires
+ real thread support. For 5.1 and earlier, -1 is returned. */
+ ret = syscall(SYS_getthrid);
#elif defined(__APPLE__)
ret = mach_thread_self();
mach_port_deallocate(mach_task_self(), ret);
#endif
-/* TODO: OpenBSD and NetBSD thread ID support */
+/* TODO: NetBSD thread ID support */
return ret;
}
diff --git a/libusb/version.h b/libusb/version.h
index 704ac39..dfc15f1 100644
--- a/libusb/version.h
+++ b/libusb/version.h
@@ -9,7 +9,7 @@
#define LIBUSB_MICRO 11
#endif
#ifndef LIBUSB_NANO
-#define LIBUSB_NANO 10495
+#define LIBUSB_NANO 10496
#endif
/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
#ifndef LIBUSB_RC