How to propagate Linux device ready for read FD state to Wine proxy WDM driver
Zebediah Figura
zfigura at codeweavers.com
Wed Jul 20 11:11:00 CDT 2022
On 7/19/22 02:48, Pavel Pisa wrote:
> What are the options? Should, can I can start service thread
> in makedep unix part and call IoCompleteRequest from there?
> In the fact I would prefer even more only register callback
> in the Wise server main loop which would be called when
> Linux device file descriptor is ready to read.
> Is there some example how to do something like that?
> What are locking requirements and limitations?
Probably, although it's a bit more awkward than that.
I don't think there are locking limitations besides what win32 imposes;
the unix call transition doesn't require or perform any locking.
What *is* relevant, though, are two restrictions:
* You can't call almost all win32 functions from a POSIX thread
(basically, anything that needs to access the TEB, because there isn't
one. Since that includes Wine debug logging, that's pretty much
everything.) That means that you probably want to start a thread on the
win32 side rather than the unix side, and possibly have it call into a
unixlib "main loop" sort of function.
* You can't directly call PE code from a unix library. This includes
both Win32 functions like IoCompleteRequest, and also user-defined
callbacks. [Note that anything starting with Nt* and exported from ntdll
is okay, though.]
This does make IRP handling more annoying. winebus (which does HID
I/O) can deal with this by wrapping poll() in a unixlib function which
is then called in a loop; wineusb is less lucky and has to deal with
libusb callbacks, so it uses an event queue. Without having looked at
your requirements, it's probable you'll want to use one of these
architectures.
ἔρρωσο,
Zeb
More information about the wine-devel
mailing list