[libvirt] [PATCH v2 1/4] Add helper function virExecDaemonize

Daniel P. Berrange berrange at redhat.com
Wed May 6 08:56:35 UTC 2009


On Mon, May 04, 2009 at 03:52:08PM -0400, Cole Robinson wrote:
> Wraps __virExec with the VIR_EXEC_DAEMON flag. Waits on the intermediate
> process to ensure we don't end up with any zombies, and differentiates between
> original process errors and intermediate process errors.


> @@ -157,20 +156,11 @@ virProxyForkServer(void)
>      proxyarg[0] = proxyPath;
>      proxyarg[1] = NULL;
>  
> -    if (virExec(NULL, proxyarg, NULL, NULL,
> -                &pid, -1, NULL, NULL, VIR_EXEC_DAEMON) < 0)
> +    if (virExecDaemonize(NULL, proxyarg, NULL, NULL,
> +                         &pid, -1, NULL, NULL, VIR_EXEC_DAEMON,
> +                         NULL, NULL) < 0)

Can remove the VIR_EXEC_DAEMON flag now, since the Daemonize
function already sets it.

> @@ -1434,38 +1434,32 @@ static int qemudStartVMDaemon(virConnectPtr conn,
>      for (i = 0 ; i < ntapfds ; i++)
>          FD_SET(tapfds[i], &keepfd);
>  
> -    ret = virExecWithHook(conn, argv, progenv, &keepfd, &child,
> -                          stdin_fd, &vm->logfile, &vm->logfile,
> -                          VIR_EXEC_NONBLOCK | VIR_EXEC_DAEMON,
> -                          qemudSecurityHook, &hookData);
> +    ret = virExecDaemonize(conn, argv, progenv, &keepfd, &child,
> +                           stdin_fd, &vm->logfile, &vm->logfile,
> +                           VIR_EXEC_NONBLOCK | VIR_EXEC_DAEMON,
> +                           qemudSecurityHook, &hookData);

Likewise here and a few others


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list