diff options
Diffstat (limited to 'net-mgmt/net-snmp53/files/patch-local:fixproc')
-rw-r--r-- | net-mgmt/net-snmp53/files/patch-local:fixproc | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/net-mgmt/net-snmp53/files/patch-local:fixproc b/net-mgmt/net-snmp53/files/patch-local:fixproc deleted file mode 100644 index 5d6e3515467d..000000000000 --- a/net-mgmt/net-snmp53/files/patch-local:fixproc +++ /dev/null @@ -1,138 +0,0 @@ ---- local/fixproc.orig Sat Apr 20 09:30:13 2002 -+++ local/fixproc Sat Mar 6 01:59:59 2004 -@@ -1,4 +1,4 @@ --#!/usr/bin/perl -+#!%%PERL%% - # - # fixproc [-min n] [-max n] [-check | -kill | -restart | -exist | -fix] proc ... - # -@@ -129,7 +129,7 @@ - # - # Timothy Kong 3/1995 - --$database_file = '/local/etc/fixproc.conf'; -+$database_file = '%%PREFIX%%/etc/fixproc.conf'; - - $debug = 0; # specify debug level using -dN - # currently defined: -d1 -@@ -155,6 +155,14 @@ - $shell_header = "#!/bin/sh\n"; - $shell_end_marker = 'shell_end_marker'; - -+open(command, "/bin/ps -p $$ |") || die "$0: can't run ps command\n"; -+if (split(' ', <command>) > 4) { -+ $ps_opts = 'ax'; -+} else { -+ $ps_opts = '-e'; -+} -+close command; -+ - &read_args(); - &read_database(); - # &dump_database(); # debug only -@@ -203,7 +211,9 @@ - $i++; - } - close (file); -- system "chmod +x $file"; -+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, -+ $atime,$mtime,$ctime,$blksize,$blocks) = stat($file); -+ chmod $mode | 0111, $file; - return file; - } - -@@ -237,8 +247,8 @@ - - # return code is number divided by 256 - $error_code = (system "$tmpfile") / 256; -- system "rm $tmpfile"; -- return ($fix_failed_error) if ($error_code != 0); -+ unlink $tmpfile; -+ return ($cannot_fix_error) if ($error_code != 0); - # sleep needed here? - return &do_exist ($proc); - } -@@ -268,7 +278,7 @@ - - # return code is number divided by 256 - $error_code = (system "$tmpfile") / 256; -- system "rm $tmpfile"; -+ unlink $tmpfile; - return ($check_failed_error) if ($error_code != 0); - - # check passed, continue -@@ -285,10 +295,12 @@ - - # do ps, check to see if min <= no. of processes <= max - $! = $fixproc_error; -- open (command, "/bin/ps -e | /bin/grep $proc | /bin/wc -l |") -+ open (command, "/bin/ps $ps_opts |") - || die "$0: can't run ps-grep-wc command\n"; -- $proc_count = <command>; -- if (($proc_count < $min{$proc}) || ($proc_count > $max{$proc})) -+ @allprocs = <command>; -+ close command; -+ @procs = grep(/$proc/, @allprocs); -+ if (($#procs < $min{$proc}) || ($#procs > $max{$proc})) - { - return $check_failed_error; - } -@@ -305,41 +317,48 @@ - - # first try kill - $! = $fixproc_error; -- open (command, "/bin/ps -e | /bin/grep $proc |") -+ open (command, "/bin/ps $ps_opts |") - || die "$0: can't run ps-grep-awk command\n"; - while (<command>) - { -- # match the first field of ps -e -+ if /$proc/ { -+ # match the first field of ps $ps_opts - $! = $fixproc_error; -- /^\s*(\d+)\s/ || die "$0: can't match ps -e output\n"; -- system "kill $1"; -+ /^\s*(\d+)\s/ || die "$0: can't match ps $ps_opts output\n"; -+ kill 15, $1; -+ } - } -+ close command; - - # if process still exist, try kill -9 - sleep 2; - $! = $fixproc_error; -- open (command, "/bin/ps -e | /bin/grep $proc |") -+ open (command, "/bin/ps $ps_opts |") - || die "$0: can't run ps-grep-awk command\n"; - $second_kill_needed = 0; - while (<command>) - { -- # match the first field of ps -e -+ if /$proc/ { -+ # match the first field of ps $ps_opts - $! = $fixproc_error; -- /^\s*(\d+)\s/ || die "$0: can't match ps -e output\n"; -- system "kill -9 $1"; -+ /^\s*(\d+)\s/ || die "$0: can't match ps $ps_opts output\n"; -+ kill 9, $1; - $second_kill_needed = 1; -+ } - } -+ close command; - return ($no_error) if ($second_kill_needed == 0); - - # see if kill -9 worked - sleep 2; - $! = $fixproc_error; -- open (command, "/bin/ps -e | /bin/grep $proc |") -+ open (command, "/bin/ps $ps_opts |") - || die "$0: can't run ps-grep-awk command\n"; - while (<command>) - { # a process still exist, return error -- return $cannot_kill_error; -+ return $cannot_kill_error if /$proc/; - } -+ close command; - return $no_error; # good, all dead - } - |