diff options
author | wpaul <wpaul@FreeBSD.org> | 2004-09-28 18:39:04 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2004-09-28 18:39:04 +0000 |
commit | 2f2f7359cc2aba3a3344e8b341e920fdcb52a1e1 (patch) | |
tree | 101d056c296a3c0fa3a14c3ac8930e695e573338 /sys/netinet | |
parent | 49fe0299db39762cc4cbcb6af27ed3a1aad69514 (diff) | |
download | FreeBSD-src-2f2f7359cc2aba3a3344e8b341e920fdcb52a1e1.zip FreeBSD-src-2f2f7359cc2aba3a3344e8b341e920fdcb52a1e1.tar.gz |
Arrgh. Recently I tried using ugen(4) in an application that uses
select(2), and discovered to my horror that ugen(4)'s bulk in/out support
is horribly lobotomized. Bulk transfers are done using the synchronous
API instead of the asynchronous one. This causes the following broken
behavior to occur:
- You open the bulk in/out ugen device and get a descriptor
- You create some other descriptor (socket, other device, etc...)
- You select on both the descriptors waiting until either one has
data ready to read
- Because of ugen's brokenness, you block in usb_bulk_transfer() inside
ugen_do_read() instead of blocking in select()
- The non-USB descriptor becomes ready for reading, but you remain blocked
on select()
- The USB descriptor becomes ready for reading
- Only now are you woken up so that you can ready data from either
descriptor.
The result is select() can only wake up when there's USB data pending. If
any other descriptor becomes ready, you lose: until the USB descriptor
becomes ready, you stay asleep.
The correct approach is to use async bulk transfers, so I changed
the read code to use the async bulk transfer API. I left the write
side alone for now since it's less of an issue.
Note that the uscanner driver has the same brokenness in it.
Diffstat (limited to 'sys/netinet')
0 files changed, 0 insertions, 0 deletions