summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-02-20 23:37:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-02-20 23:37:40 +0000
commit1d3889ec5a6a11028581d796dc64fff305bdcfa0 (patch)
tree2b1daa08496eb35d8567a775bdaee326c62327c3
parentf2b6e1b5714defe249f74e59e7d624bd32a9c68b (diff)
downloaddrakx-backup-do-not-use-1d3889ec5a6a11028581d796dc64fff305bdcfa0.tar
drakx-backup-do-not-use-1d3889ec5a6a11028581d796dc64fff305bdcfa0.tar.gz
drakx-backup-do-not-use-1d3889ec5a6a11028581d796dc64fff305bdcfa0.tar.bz2
drakx-backup-do-not-use-1d3889ec5a6a11028581d796dc64fff305bdcfa0.tar.xz
drakx-backup-do-not-use-1d3889ec5a6a11028581d796dc64fff305bdcfa0.zip
much simpler & stronger killing of still running processes
-rw-r--r--perl-install/pkgs.pm26
1 files changed, 2 insertions, 24 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 790063ced..0d93e3601 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -1477,30 +1477,8 @@ sub install($$$;$$) {
close OUTPUT;
#- now search for child process which may be locking the cdrom, making it unable to be ejected.
- my (@killpid, %tree, $pid);
- local (*DIR, *F, $_);
- opendir DIR, "/proc";
- while ($pid = readdir DIR) {
- $pid =~ /^\d+$/ or next;
- open F, "/proc/$pid/status";
- while (<F>) {
- /^Pid:\s+(\d+)/ and $pid == $1 || die "incorrect pid reported for $pid (found $1)";
- if (/^PPid:\s+(\d+)/) {
- $tree{$pid} and die "PPID already found for $pid, previously $tree{$pid}, now $1";
- $tree{$pid} = $1;
- }
- }
- close F;
- }
- closedir DIR;
- foreach (keys %tree) {
- #- remove child of this process (which will terminate).
- $pid = $_; while ($pid = $tree{$pid}) { $pid == $$ and push @killpid, $_ }
- #- remove child of 1 direct that have a pid greater than current one.
- $_ > $$ && $tree{$_} == 1 and push @killpid, $_;
- }
- if (@killpid) {
- log::l("killing process ". join(", ", @killpid));
+ if (my @killpid = grep { $_ > $$ } all("/proc")) {
+ log::l("ERROR: DrakX should not have to clean the packages shit. Killing ". join(", ", @killpid));
kill 15, @killpid;
sleep 2;
kill 9, @killpid;