X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Flaunch.c;h=1a47363d5f14e3e3aafd05c9ba6eb20c962019f7;hb=1c0f75c80689580da73e27c1b4e4d26d4fb2cae8;hp=0b15ce98d79fac55032a7e93788f62d0011e8c34;hpb=64841fe8957f798df12a38bd81843c7011f2c278;p=libguestfs.git diff --git a/src/launch.c b/src/launch.c index 0b15ce9..1a47363 100644 --- a/src/launch.c +++ b/src/launch.c @@ -643,12 +643,9 @@ launch_appliance (guestfs_h *g) close (rfd[1]); } -#if 0 - /* Set up a new process group, so we can signal this process - * and all subprocesses (eg. if qemu is really a shell script). - */ - setpgid (0, 0); -#endif + /* Put qemu in a new process group. */ + if (g->pgroup) + setpgid (0, 0); setenv ("LC_ALL", "C", 1); @@ -677,6 +674,14 @@ launch_appliance (guestfs_h *g) pid_t qemu_pid = g->pid; pid_t parent_pid = getppid (); + /* It would be nice to be able to put this in the same process + * group as qemu (ie. setpgid (0, qemu_pid)). However this is + * not possible because we don't have any guarantee here that + * the qemu process has started yet. + */ + if (g->pgroup) + setpgid (0, 0); + /* Writing to argv is hideously complicated and error prone. See: * http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/misc/ps_status.c?rev=1.33.2.1;content-type=text%2Fplain */