Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / perl5 / eg / scan / scan_ps
1 #!/usr/bin/perl -P
2
3 # $RCSfile: scan_ps,v $$Revision: 4.1 $$Date: 92/08/07 17:20:40 $
4
5 # This looks for looping processes.
6
7 #if defined(mc300) || defined(mc500) || defined(mc700)
8 open(Ps, '/bin/ps -el|') || die "scan_ps: can't run ps";
9
10 while (<Ps>) {
11     next if /rwhod/;
12     print if index(' T', substr($_,62,1)) < 0;
13 }
14 #else
15 open(Ps, '/bin/ps auxww|') || die "scan_ps: can't run ps";
16
17 while (<Ps>) {
18     next if /dataserver/;
19     next if /nfsd/;
20     next if /update/;
21     next if /ypserv/;
22     next if /rwhod/;
23     next if /routed/;
24     next if /pagedaemon/;
25 #ifdef vax
26     ($user,$pid,$cpu,$mem,$sz,$rss,$tt,$stat,$start,$time) = split;
27 #else
28     ($user,$pid,$cpu,$mem,$sz,$rss,$tt,$stat,$time) = split;
29 #endif
30     print if length($time) > 4;
31 }
32 #endif