On Mon, Dec 29, 2008 at 03:36:15PM +0100, Guido G?nther wrote: > On Mon, Dec 15, 2008 at 02:22:42PM +0100, Daniel Veillard wrote: > > On Mon, Dec 15, 2008 at 11:21:20AM +0000, Daniel P. Berrange wrote: > > > On Fri, Dec 12, 2008 at 07:26:32PM +0100, Guido G?nther wrote: > > > > + if (kill(vm->pid, SIGTERM) < 0) > > > > + qemudLog(QEMUD_ERROR, _("Failed to send SIGTERM to %s (%d): %s\n"), > > > > + vm->def->name, vm->pid, strerror(errno)); > > > > > > We should add a guard around all the kill() statements for > > > > > > if (vm->pid > 1) > > > kill.. > > > > > > One of the bugs I found when doing the LXC/UML drivers is that when relying > > > on an external PID file, some things can go wrong in unexpected ways that > > > just don't happen when getting the PID straight back from fork. This often > > > ended up with vm->pid being -1, 0 with horrific results - > > > > > > "If pid equals -1, then sig is sent to every process for which the calling > > > process has permission to send signals, except for process 1 (init)" > > > > > > Yes, I killed every single process on my dev machine several times before > > > discovering this isues :-) > > > > This call for an utility function > > int virKillProcess(pid_t pid, int sig) > > call checking for this, could also help on debugging/logging > O.k. to apply the attached version of virKillProcess? I'm already using > this in the libvirtd restart patches. ACK 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 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list