[libvirt] Raising events for testing

Daniel P. Berrange berrange at redhat.com
Mon Jan 31 17:47:40 UTC 2011


On Sun, Jan 30, 2011 at 01:21:37PM +0100, arnaud.champion at devatom.fr wrote:
> Hi,
> 
> One thing I need to understand, in the callback python or c samples,
> the fileDescriptor is on a socket or on a pipe ?

Internally libvirt may have a opened pipe, file, socket, or something
else. In all cases, the 'fd' parameter that is passed to callbacks is
what Microsoft call "a C runtime file descriptor". In particular what
you get in a callback is *not* a HANDLE or SOCKET object, even if the
underlying object libvirt has internally is a SOCKET/HANDLE.

Basically the libvirt code on Windows that creates sockets
does

   SOCKET s = WSASocket(...)
   int fd = _open_osfhandle(s);

The callback gets 'fd', and not 's'.

Regard,
Daniel




More information about the libvir-list mailing list