On Tue, May 8, 2012 at 6:16 PM, Pete Batard <p...@akeo.ie> wrote: > On 2012.05.08 11:07, Xiaofan Chen wrote: >> >> Martin's answer: >> "This is normal, you must use an OpenBSD -current in order >> to have real threads enable, until 5.1 OpenBSD only has >> userland threads." > > OK. If possible, can you try the attached patch on your > platform and let me know whether you get a proper > thread ID then? This returns -1 on mine, but > if we can get something better for -current, we might > as well go for it.
Yes I agree with you here. > > diff --git a/libusb/os/threads_posix.c b/libusb/os/threads_posix.c > index 8e9b490..960b3c2 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,6 +66,8 @@ int usbi_get_tid(void) > int ret = -1; > #if defined(__linux__) > ret = syscall(SYS_gettid); > +#elif defined(__OpenBSD__) > + ret = syscall(SYS_getthrid); > #elif defined(__APPLE__) > ret = mach_thread_self(); > mach_port_deallocate(mach_task_self(), ret); > I downloaded your attached patch. Somehow both "git am" and "patch -p1" failed. So I manually change the file and indeed it seem to work fine under OpenBSD Current. Thanks. bash-4.2$ git am OpenBSD_threadID.patch Patch format detection failed. bash-4.2$ patch -p1 < OpenBSD_threadID.patch Hmm... Looks like a unified diff to me... The text leading up to this was: -------------------------- |diff --git a/libusb/os/threads_posix.c b/libusb/os/threads_posix.c |index 8e9b490..960b3c2 100644 |--- a/libusb/os/threads_posix.c |+++ b/libusb/os/threads_posix.c -------------------------- Patching file libusb/os/threads_posix.c using Plan A... Hunk #1 failed at 19. Hunk #2 failed at 66. 2 out of 2 hunks failed--saving rejects to libusb/os/threads_posix.c.rej done bash-4.2$ ./listdevs [timestamp] [threadID] facility level [function call] <message> -------------------------------------------------------------------------------- [ 0.000000] [000f4905] libusbx: debug [libusb_init] [ 0.000661] [000f4905] libusbx: debug [usbi_add_pollfd] add fd 3 events 1 [ 0.000949] [000f4905] libusbx: debug [libusb_init] created default context [ 0.001228] [000f4905] libusbx: debug [libusb_get_device_list] [ 0.001409] [000f4905] libusbx: debug [obsd_get_device_list] [ 0.001915] [000f4905] libusbx: debug [libusb_exit] [ 0.006304] [000f4905] libusbx: debug [libusb_exit] destroying default context [ 0.006698] [000f4905] libusbx: debug [usbi_remove_pollfd] remove fd 3 bash-4.2$ ./listdevs [timestamp] [threadID] facility level [function call] <message> -------------------------------------------------------------------------------- [ 0.000000] [000f5925] libusbx: debug [libusb_init] [ 0.001649] [000f5925] libusbx: debug [usbi_add_pollfd] add fd 3 events 1 [ 0.001681] [000f5925] libusbx: debug [libusb_init] created default context [ 0.001712] [000f5925] libusbx: debug [libusb_get_device_list] [ 0.001727] [000f5925] libusbx: debug [obsd_get_device_list] [ 0.002047] [000f5925] libusbx: debug [libusb_exit] [ 0.002063] [000f5925] libusbx: debug [libusb_exit] destroying default context [ 0.002077] [000f5925] libusbx: debug [usbi_remove_pollfd] remove fd 3 bash-4.2$ ./listdevs [timestamp] [threadID] facility level [function call] <message> -------------------------------------------------------------------------------- [ 0.000000] [000f814c] libusbx: debug [libusb_init] [ 0.001766] [000f814c] libusbx: debug [usbi_add_pollfd] add fd 3 events 1 [ 0.001800] [000f814c] libusbx: debug [libusb_init] created default context [ 0.001833] [000f814c] libusbx: debug [libusb_get_device_list] [ 0.001848] [000f814c] libusbx: debug [obsd_get_device_list] [ 0.031331] [000f814c] libusbx: debug [_cache_active_config_descriptor] fd 5 [ 0.031361] [000f814c] libusbx: debug [_cache_active_config_descriptor] active bLength 9 [ 0.031375] [000f814c] libusbx: debug [_cache_active_config_descriptor] index -1, len 63 [ 0.031391] [000f814c] libusbx: debug [obsd_get_device_descriptor] [ 0.031752] [000f814c] libusbx: debug [libusb_get_device_descriptor] [ 0.031767] [000f814c] libusbx: debug [obsd_get_device_descriptor] 04d8:fa2e (bus 0, device 2) [ 0.031805] [000f814c] libusbx: debug [libusb_exit] [ 0.031819] [000f814c] libusbx: debug [libusb_exit] destroying default context [ 0.031833] [000f814c] libusbx: debug [usbi_remove_pollfd] remove fd 3 -- Xiaofan ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel