Daniel P. Berrange wrote:
On Mon, Sep 08, 2008 at 04:08:01PM +0100, Jamie Lokier wrote:
Gerd Hoffmann wrote:
Beside that I still think it would be a good idea to separate
qemu and
the gui into two separate processes, so you can close the GUI
window and
keep the VM running. It also solves the dependency issue for
distros as
the gtk frontend with all the dependencies can just go into a
separate
sub-package.
Extending VNC with a "shared memory" extension, similar to Xlib's
MIT-SHM extension, and implementing it in QEMU and Gtk-VNC would
be a
nice way to do this.
Funny you should mention that. Anthony had code todo exactly that
against
for both QEMU and GTK-VNC a while back. We had it in the GTK-VNC
for a short while but removed it due to some race conditions in its
impl, and
it interracted badly with our OpenGL impl. We could easily revisit
this
idea if it were thought to be important / useful.
The difficulty is deleting the shared memory segment reliably.
Normally, what you want to do is:
shmget()
shmat()
shmctl(IPC_RMID)
...
shmdt()
And the first sequence has to be as reliable and quick as possible
because if you exit before the shmctl(), you'll leak the shared
memory.
Unfortunately, you have to shmget() in the client and shmat() in the
server and client, so that means:
shmget()
shmat()
...
notify server of key
wait for server to confirm shmat()
...
shmctl(IPC_RMID)
..
shmdt()
Which leaves a huge window open where bad things can happen. The
client can exit, the client can crash. This is particularly
troublesome in a library because it's really not nice to try and
register an atexit() handler or something like that from a library.
It would be nice to come up with a solution to this.
Regards,
Anthony Liguori
Daniel