| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libvirt-glib dependency was dropped in commit 296f91c in favor to
maintain the full glib event loop integration into virt-viewer tree.
This decision was taken because libvirt-glib was not mature enough at
that time, which is not the case nowadays.
The libvirt-glib version chosen as dependency (0.1.8) is the first
release that includes the fixes for the glib event loop integration that
were backported to virt-viewer last year.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
|
|
|
|
|
|
| |
With glib requirements now being 2.38, these functions do not make sense anymore.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
virt_viewer_events_add_handle() creates a GIOChannel in order to watch the
fd it was given for changes.
virt_viewer_events_remove_handle() is freeing all the resources allocated by
virt_viewer_events_add_handle() except for this GIOChannel. This commit adds
the needed g_io_channel_unref() call to virt_viewer_events_remove_handle()
Based on commit 8e95b8d25a3eee6316aff2f83b0c449aaf10984a from
libvirt-glib.
Original author: Christophe Fergeau <cfergeau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
|
| |
Trying to remove a disabled timer or handle will cause
virt_viewer_events_remove_{handle,timeout}() to return an error
rather than removing it.
Based on commit 79699d73e6e1b7218e3bd8349d176752f86128b9 from
libvirt-glib.
Original author: Christophe Fergeau <cfergeau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's possible to create a handle to watch for file events which do not
watch for any file event. Such a handle can be enabled later with
virt_viewer_events_update_handle() by setting some conditions to watch for.
When a handle is disabled after it has been created,
virt_viewer_events_update_handle() makes sure it removes the corresponding
virt_viewer_events_handle::source IO watch if any was set.
virt_viewer_events_add_handle() will always create a
virt_viewer_events_handle::source IO watch even if the handle is not
watching for any events.
This commit makes consistent by only creating a watch with g_io_add_watch()
when the caller asked to watch for some events.
Based on commit d71c143936a35cd6c3f23ae0cbf7f3215d944051 from
libvirt-glib.
Original author: Christophe Fergeau <cfergeau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The _event_timeout_remove and _event_handle_remove methods
were holding onto the global lock when invoking the free
callback. This is a violation of the libvirt events API
contract which requires free callbacks to be invoked in
a re-entrant safe context.
Based on commit dd17c3cc587c73a8c915238f9d9a3e200e89c93f from
libvirt-glib.
Original author: Daniel P. Berrange <berrange@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The deletion of libvirt timeouts/watches is done in 2 steps:
- the first step is synchronous and unregisters the timeout/watch
from glib mainloop
- the second step is asynchronous and triggered from the first step.
It releases the memory used for bookkeeping for the timeout/watch
being deleted
This is done this way to avoid some possible deadlocks when
reentering the sync callback while freeing the memory associated
with the timeout/watch.
However, it's possible to call gvir_event_update_handle after
gvir_event_remove_handle but before _event_handle_remove does
the final cleanup. When this happen, _update_handle will reregister
the handle with glib mainloop, and bad things will happen when
a glib callback is triggered for this event after _event_handle_remove
has freed the memory associated with this handle watch.
This commit marks the timeouts and watches as removed in the
synchronous _remove callback and makes sure removed timeouts/watches
are ignored in _update callbacks.
Based on commit 3e73e0cee977fb20dd29db3ccfe85b00cc386c43 from
libvirt-glib.
Original author: Christophe Fergeau <cfergeau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Timeout and watch deletion is done from an idle callback. However,
we cannot assume that all libvirt event calls (the callbacks passed
to virEventRegisterImpl) will be done from the mainloop thread. It's
thus possible that a libvirt event call will run a thread while
one of the idle deletion callbacks runs.
Given that the 'handles' and 'timeouts' arrays are shared among all
threads, we need to make sure we hold the 'eventlock' mutex before
modifying them.
Based on commit 924178f6b35735458b37d30303fe7bc753dde0b1 from
libvirt-glib.
Original author: Christophe Fergeau <cfergeau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
| |
Based on commit 1fb34633ef3b318ea678b775d5e47debc98d2184 from
libvirt-glib.
Original author: Christophe Fergeau <cfergeau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In libvirt, it's perfectly possible and widely used to have disabled
timers (timeout=-1) and fire them up 'randomly' with timeout=0.
However, with current mapping into glib mainloop it's not possible
and causing troubles.
Based on commit a40a1732e0d53fcc44b8d348cec97152dafd2b88 from
libvirt-glib.
Original author: Michal Privoznik <mprivozn@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
| |
Since 2.31, g_mutex_new() is deprecated.
Based on commit 2dc7476d32a9e158e688486e8f184c719c53bb4c from
libvirt-glib.
Original author: Daniel P. Berrange <berrange@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise, it will crash next time it goes find()
Backtrace:
(gdb) where
#0 0x00007efcae715095 in g_io_create_watch () from
/lib64/libglib-2.0.so.0
#1 0x00007efcae7150ef in g_io_add_watch_full () from
/lib64/libglib-2.0.so.0
#2 0x00000000004275ba in virt_viewer_events_update_handle
(watch=<optimized out>, events=1) at
virt-viewer-events.c:158
#3 0x00007efcb1a62dce in virNetSocketUpdateIOCallback (sock=0x1e75c00,
events=1) at rpc/virnetsocket.c:1981
#4 0x00007efcb1a50113 in virNetClientIOUpdateCallback
(client=<optimized out>, enableCallback=<optimized out>) at
rpc/virnetclient.c:1639
#5 0x00007efcb1a50f82 in virNetClientIO (thiscall=0x20e0170,
client=0x1f2e060) at rpc/virnetclient.c:1793
#6 virNetClientSendInternal (client=client@entry=0x1f2e060,
msg=msg@entry=0x20e0100,
expectReply=expectReply@entry=false, nonBlock=nonBlock@entry=true) at
rpc/virnetclient.c:1962
#7 0x00007efcb1a52413 in virNetClientSendNonBlock (client=0x1f2e060,
msg=msg@entry=0x20e0100) at
rpc/virnetclient.c:2036
#8 0x00007efcb1a5243d in virNetClientKeepAliveSendCB (opaque=<optimized
out>, msg=0x20e0100) at
rpc/virnetclient.c:293
#9 0x00007efcb1a5ba02 in virKeepAliveTimer (timer=<optimized out>,
opaque=0x20d3d00) at rpc/virkeepalive.c:176
#10 0x00000000004272e9 in virt_viewer_events_dispatch_timeout
(opaque=0x1e6cd30) at virt-viewer-events.c:233
#11 0x00007efcae7231b3 in g_timeout_dispatch () from
/lib64/libglib-2.0.so.0
#12 0x00007efcae72279a in g_main_context_dispatch () from
/lib64/libglib-2.0.so.0
#13 0x00007efcae722ae8 in g_main_context_iterate.isra.24 () from
/lib64/libglib-2.0.so.0
#14 0x00007efcae722dba in g_main_loop_run () from
/lib64/libglib-2.0.so.0
#15 0x00007efcb054a045 in gtk_main () from /lib64/libgtk-3.so.0
#16 0x0000000000410a9c in main (argc=1, argv=0x7ffde58a7978) at
virt-viewer-main.c:124
Based on commit cff5f1c46f4b9661e112b85159fb58ae473a9a89 from
libvirt-glib.
Original author: Marc-André Lureau <marcandre.lureau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
| |
Based on commit 8f8d9ce5238dbcbce40aa04ba55b8c55f97c79c0 from
libvirt-glib.
Original author: Marc-André Lureau <marcandre.lureau@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
|
|
| |
Take a global lock whenever changing any event callbacks to ensure
thread safety.
Based on commit f1fe67da2dac6a249f796535b8dbd155d5741ad7 from
libvirt-glib.
Original author: Daniel P. Berrange <berrange@redhat.com>
Related to: rhbz#1243228
|
|
|
|
|
|
|
|
|
| |
Using %d as a format-specifier for intptr_t causes a warning with
mingw64:
virt-viewer-events.c: In function 'virt_viewer_events_add_handle':
virt-viewer-events.c:103:5: warning: format '%d' expects argument of
type 'int', but argument 5 has type 'intptr_t' [-Wformat=]
g_debug("Converted fd %d to handle %d", fd, _get_osfhandle(fd));
|
|
|
|
| |
https://bugzilla.redhat.com/show_bug.cgi?id=1107518
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Libvirt uses gnulib for making winsock look like POSIX
sockets. This means that in the libvirt event handle
callbacks the application will be given a file descriptor
rather than a winsock HANDLE object. The g_io_channel_unix_new
method will detect that it is an FD and delegate to the
g_io_channel_win32_new_fd method. Unfortunately the glib Win32
event loop impl is not very good at dealing with FD objects,
simulating poll() by doing a read() on the FD :-(
The API docs for g_io_channel_win32_new_fd say
"All reads from the file descriptor should be done by
this internal GLib thread. Your code should call only
g_io_channel_read()."
This isn't going to fly for libvirt, since it has zero
knowledge of glib at all, so is just doing normal read().
Fortunately we can work around this problem by turning
the FD we get from libvirt back into a HANDLE using the
_get_osfhandle() method.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
If 'ff' callbacks are invoked directly from the remove
callback they will likely deadlock in libvirt. They must
be invoked from a clean stack, so switch to using a
glib idle callback.
|
| |
|
|
All source files must be named
virt-viewer-XXXX
All methods named
virt_viewer_XXX
|