[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libvir] PATCH: Check for /usr/bin/qemu* binaries before starting guest



On Mon, 2007-04-16 at 11:49 +0100, Richard W.M. Jones wrote:

> Olwm (the old OpenLook window manager) solved both problems in this way. 
>   From the olwm man page[2]:
> 
>       -syncpid process-id
>            When olwm has completed  its  initialization,  it  will
>            send  a  signal (SIGALRM by default) to process-id.

	X does something similar, in that if you set the signal handler to
SIG_IGN for USR1 before exec-ing it, then X will send a USR1 to its
parent once it has initialised.

	This is solving a different problem, though - how does the parent
process know when the child process has initialised and is ready to e.g.
start accepting connections? That's why it has "sync" in the name - it's
a synchronisation thing, rather than an error reporting thing.

	i.e. for error handling, you don't want to have to block for this "I'm
ready" signal, you don't want to have to have timeout for the case where
you never get the signal, and you want to actually know what went wrong
if there was an error.

	The best way for a child to report an errno from exec() is to pass it
back via a pipe which was created by the parent. That way the parent
doesn't have to block. Note, the child should mark its side of the pipe
with CLOEXEC.

Cheers,
Mark.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]