On 08/14/2012 09:35 AM, mzawdx wang wrote:
Hi all:
I am now reading the source codes of libvirt with version 0.9.2 ,
You'd be better off investigating the source code of libvirt.git (the
current development is working towards 0.10.0 as the successor to the
released 0.9.13); 0.9.2 is quite old.
and be stuck by the function "qemudDispatchServerEvent". as
you can see:
static void
qemudDispatchServerEvent(int watch, int fd, int events, void *opaque) {
In fact, in the meantime, this function was deleted in commit df0b57a95
(0.9.3) as part of using a newer RPC framework under src/rpc.
...
}
My question is : except for the argument "void *opaque", when and how the
other three arguments (int watch, int fd, int events) being incoming ?
For it is a static function, I look through the source file "libvirt.c" and
find no answer .
Could someone give me a help ?
If you insist on debugging 0.9.2, look at
daemon/libvirtd.c:qemudNetworkEnable, which passes the address of
qemudDispatchServerEvent as a callback pointer to virEventAddHandle.
Thus, any time a poll() on the connection socket completes,
qemudDispatchServerEvent() will be called with the information learned
from that poll. In particular,
src/util/event_poll.c:virEventPollDispatchTimeouts() is a location that
calls the callback function.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org