WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] libxl: Call setsid(2) before exec'ing device model

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] libxl: Call setsid(2) before exec'ing device model
From: Jim Fehlig <jfehlig@xxxxxxxxxx>
Date: Mon, 07 Mar 2011 19:55:37 -0700
Delivery-date: Mon, 07 Mar 2011 19:00:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.24 (X11/20100302)
While developing libvirt libxl driver I noticed that terminating the
client causes any qemu-dm processes indirectly started by the client to
also terminate.  Calling setsid(2) before exec'ing qemu-dm resolves the
issue but I'm not quite sure about the placement of the setsid() call or
any unforeseen side-affects of its use.  Comments welcome.

Regards,
Jim

# HG changeset patch
# User Jim Fehlig <jfehlig@xxxxxxxxxx>
# Date 1299552244 25200
# Node ID 94fde77241912b634b492979ffc8cdb9516d6136
# Parent  d8a65dd15d703ba302b0141e9ffe447ff1cd2a64
Call setsid(2) before exec'ing device model

While doing development on libvirt libxenlight driver I noticed
that terminating a libxenlight client causes any qemu-dm
processes that were indirectly created by the client to also
terminate.  Calling setsid(2) before exec'ing qemu-dm resolves
the issue.

    Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxxxx>

diff -r d8a65dd15d70 -r 94fde7724191 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Feb 17 11:21:47 2011 -0700
+++ b/tools/libxl/libxl_dm.c    Mon Mar 07 19:44:04 2011 -0700
@@ -681,6 +681,7 @@
     if (rc < 0)
         goto out_close;
     if (!rc) { /* inner child */
+        setsid();
         libxl__exec(null, logfile_w, logfile_w,
                    libxl__abs_path(&gc, info->device_model, 
libxl_libexec_path()),
                    args);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>