import top_3_5beta12
This commit is contained in:
parent
aee34003d7
commit
4f4f23c131
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/top/dist/; revision=89750 svn path=/vendor/top/3.5beta12/; revision=89752; tag=vendor/top/3.5beta12
@ -11,7 +11,8 @@ through the company Group sys Consulting. William's specialties are:
|
|||||||
Local area network design
|
Local area network design
|
||||||
Design of safe connections to the Internet
|
Design of safe connections to the Internet
|
||||||
Domain Name Service
|
Domain Name Service
|
||||||
Unix and Internet security
|
Threaded programming with pthreads
|
||||||
|
Netscape Server API plugins
|
||||||
INN news server configuration
|
INN news server configuration
|
||||||
SunOS to Solaris migration
|
SunOS to Solaris migration
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
@ -23,4 +24,5 @@ other countries can be arranged as well.
|
|||||||
|
|
||||||
If you are interested in having William work for your organization,
|
If you are interested in having William work for your organization,
|
||||||
contact him at +1-770-813-3224 or via the address "wnl@groupsys.com".
|
contact him at +1-770-813-3224 or via the address "wnl@groupsys.com".
|
||||||
|
You may also wish to visit the Group sys web page at www.groupsys.com.
|
||||||
|
|
||||||
|
@ -1,3 +1,132 @@
|
|||||||
|
Thu Mar 30 2000 - wnl (3.5beta12)
|
||||||
|
Updated modules: m_aix41.c, m_aix43.c, m_mtxinu.c, m_sco5.c,
|
||||||
|
and m_ultrix4.c.
|
||||||
|
Included m_irixsgi.c from some source that's been floating around
|
||||||
|
SGI. Don't yet know how it compares to m_irix62.
|
||||||
|
|
||||||
|
Fri Mar 10 2000 - wnl (3.5beta11)
|
||||||
|
top.c: avoid potential loop if stdout gets closed, use macro
|
||||||
|
for p_active to avoid collision with system macros.
|
||||||
|
m_sunos5: widened some fields to accomodate 5.8.
|
||||||
|
m_decosf1: added ordering support
|
||||||
|
m_irix62_64: provides 64-bit module based on m_irix62.
|
||||||
|
m_irix62: skip bogus files in /proc directory
|
||||||
|
m_svr42MP and m_svr5: complete replacement with updated copies
|
||||||
|
m_mtxinu: complete replacement with updated copies
|
||||||
|
m_aix43: new module for 4.3
|
||||||
|
getans: replaced with a Bourne shell script
|
||||||
|
|
||||||
|
Mon Mar 6 2000 - wnl (3.5beta10)
|
||||||
|
m_sunos5.c: workaround for curses bug: ensure that TERMINFO has
|
||||||
|
a value.
|
||||||
|
|
||||||
|
Fri Jan 15 1999 - wnl (3.5beta10)
|
||||||
|
top.c: now check return code from read to avoid looping on eof.
|
||||||
|
top.c: delay of 0 now only valid for root.
|
||||||
|
decosf1.c: patches from Rainer Orth should fix most of the
|
||||||
|
problems with this module (including the display of certain
|
||||||
|
processes and runtime errors).
|
||||||
|
sunos5.c: Rainer insisted on putting the slash back in the
|
||||||
|
state field ("run/4") and widened the field to accomodate it.
|
||||||
|
aix.c: widened PID field for 6-digit pids (shortened NICE field)
|
||||||
|
module macosx added, thanks to Andrew Townley.
|
||||||
|
|
||||||
|
Fri Dec 18 1998 - wnl (3.5beta9)
|
||||||
|
Configure checks status of "make" and complains if it fails.
|
||||||
|
|
||||||
|
Thu Dec 17 1998 - wnl (3.5beta9)
|
||||||
|
Added module sco5 from Mike Hopkirk.
|
||||||
|
Added module netbsd132 from moto kawasaki.
|
||||||
|
|
||||||
|
Sun Oct 25 1998 - wnl (3.5beta9)
|
||||||
|
Added Casper's patches for sunos5 for the following:
|
||||||
|
produce same results as swap -s (5.5 and higher),
|
||||||
|
don't use system_pages kstat when /dev/kmem can be opened,
|
||||||
|
skip . and .. when reading /proc, replace use of SOLARIS24
|
||||||
|
with OSREV.
|
||||||
|
|
||||||
|
Fri Sep 11 1998 - wnl (3.5beta9)
|
||||||
|
Added workaround to getans for the absence of $< in SCO Unix.
|
||||||
|
|
||||||
|
Wed Jul 1 1998 - wnl (3.5beta9)
|
||||||
|
Changed structure member "errno" to "errnum" in commands.c.
|
||||||
|
Replaced hpux10 module with one from John Haxby.
|
||||||
|
|
||||||
|
Fri Apr 17 1998 - wnl (3.5beta8)
|
||||||
|
Moved definition of _KMEMUSER earlier in m_sunos5.c. This should
|
||||||
|
fix the compilation problem with gnu 2.7.2.3, obviating the need
|
||||||
|
for the fixinc.svr4 patch, but hopefully will not affect anything
|
||||||
|
else.
|
||||||
|
Added -DORDER to m_sunos4mp.c
|
||||||
|
|
||||||
|
Tue Nov 18 1997 - wnl (3.5beta7)
|
||||||
|
Added gcc 2.7.2.3 patch for fixinc.svr4 and changed INSTALL and
|
||||||
|
FAQ to refer to it.
|
||||||
|
Added NetBSD HP9000 fix. Hopefully it doesn't break other
|
||||||
|
NetBSD platforms.
|
||||||
|
|
||||||
|
Fri Oct 24 1997 - wnl (3.5beta7)
|
||||||
|
Modified m_dcosx.c to change uses of procdir to xprocdir, avoiding
|
||||||
|
a name clash with an include file (Bryn Parrott)
|
||||||
|
|
||||||
|
Sat Oct 11 1997 - wnl (3.5beta6)
|
||||||
|
Incorporated Casper's patches for Solaris 2.6 and for the multi-
|
||||||
|
processor bug ("kstat finds too many cpus").
|
||||||
|
|
||||||
|
Sun Jan 20 1996 - wnl (3.5beta5)
|
||||||
|
Fixed Casper's m_sunos5 module: there was a poor interaction with
|
||||||
|
his use of OSREV and SunOS 5.5.1.
|
||||||
|
|
||||||
|
Fri Dec 20 1996 - wnl (3.5beta4)
|
||||||
|
Replaced m_sunos5 with a reworked version by Casper Dik. This one
|
||||||
|
should work under 2.6 and may not require that top be run setuid
|
||||||
|
to root under 2.5 or 2.6. This also fixed a bug in m_sunos5 that
|
||||||
|
was introduced in beta3.
|
||||||
|
Fixed calculation of OSREV in Configure.
|
||||||
|
|
||||||
|
Wed Nov 20 1996 - wnl (3.5beta3)
|
||||||
|
Incorporated contributed fixes to: bsdos2, irix62, freebsd20,
|
||||||
|
ultrix4, sunos5. Changed calculation of swap area in sunos5 (now
|
||||||
|
uses swapctl). sunos5 now understands idled processors. Changed
|
||||||
|
Configure to determine os revision using uname (when available)
|
||||||
|
and adding it to machine.c compiliation in Makefile as -DOSREV.
|
||||||
|
Changed calls to "exit" in modules to use "quit" instead.
|
||||||
|
|
||||||
|
Oct 20 1996 - wnl (3.5beta3)
|
||||||
|
Removed "time" from list of ordering choices: there's no easy way
|
||||||
|
to get cpu time for all processes (it's in the u area).
|
||||||
|
|
||||||
|
Fri Oct 18 1996 - wnl (3.5beta3)
|
||||||
|
hpux10 and hpux9: using a better means for determining when a
|
||||||
|
process is idle.
|
||||||
|
decosf1 now includes utils.h.
|
||||||
|
|
||||||
|
Fri Sep 13 1996 - wnl (3.5beta2)
|
||||||
|
Fixed Configure to build Make.desc in such a way that doesn't
|
||||||
|
require a long argument to sed.
|
||||||
|
|
||||||
|
Thu Sep 12 1996 - wnl (3.5beta2)
|
||||||
|
Fixed bug in display.c that affected empty cpustate names.
|
||||||
|
Created hpux1010 module - a variant of hpux10 that does not use
|
||||||
|
struct proc or struct user (suitable for HP/UX 10.10).
|
||||||
|
|
||||||
|
Wed Sep 11 1996 - wnl (3.5beta2)
|
||||||
|
Changes to sunos5 module: Removed WCPU column since it is meaningless
|
||||||
|
on a SVR4-based system. Added THR column to show number of threads
|
||||||
|
for each process. This was not straightforward: the information is
|
||||||
|
not stored in prpsinfo but rather in prstatus.
|
||||||
|
|
||||||
|
Tue Sep 10 1996 - wnl (3.5beta1)
|
||||||
|
Added patches for sunos4mp to provide order support.
|
||||||
|
Added irix62 module.
|
||||||
|
Changed prime.c to include stdio.h for printf prototype.
|
||||||
|
Added conditional code to os.h and utils.c to handle systems
|
||||||
|
where sys_errlist is defined in stdio.h (such as NetBSD).
|
||||||
|
|
||||||
|
Mon Sep 09 1996 - wnl (3.5beta1)
|
||||||
|
Removed tar and shar rules from Makefile.X -- don't need them anymore.
|
||||||
|
Added -v option to display version number. Updated man page.
|
||||||
|
|
||||||
Thu Aug 29 1996 - wnl (3.4)
|
Thu Aug 29 1996 - wnl (3.4)
|
||||||
Replaced modules (from Tim Pugh): next 32, next40.
|
Replaced modules (from Tim Pugh): next 32, next40.
|
||||||
Fixed bug in username.c: hashing negative uids.
|
Fixed bug in username.c: hashing negative uids.
|
||||||
|
@ -25,7 +25,7 @@ if ($#argv > 0) then
|
|||||||
set fastrack = 1
|
set fastrack = 1
|
||||||
else
|
else
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
Configuration for top, version 3.4
|
Configuration for top, version 3.5
|
||||||
|
|
||||||
One moment....
|
One moment....
|
||||||
'EOF'
|
'EOF'
|
||||||
@ -37,11 +37,17 @@ ls machine/m_*.man >$$.m
|
|||||||
sed -e 's@^machine/m_@@' -e 's/.c$//' $$.f >$$.n
|
sed -e 's@^machine/m_@@' -e 's/.c$//' $$.f >$$.n
|
||||||
|
|
||||||
# build Make.desc
|
# build Make.desc
|
||||||
set descs = `sed -e 's@\.c$@.desc@' $$.f`
|
sed -e 's@\.c@.desc\\@' $$.f | sed -e '$s/\\//' >$$.a
|
||||||
sed -e "s@%descs%@$descs@" Make.desc.X >Make.desc
|
sed -e "/^DESCS/r $$.a" Make.desc.X >Make.desc
|
||||||
|
|
||||||
# build desc files and SYNOPSIS as needed
|
# build desc files and SYNOPSIS as needed
|
||||||
make -f Make.desc >/dev/null
|
make -f Make.desc >/dev/null
|
||||||
|
if ($status != 0) then
|
||||||
|
echo "Unable to build the synopsis."
|
||||||
|
echo 'Make sure the command "make" is on your path and try'
|
||||||
|
echo 'running Configure again.'
|
||||||
|
exit 1
|
||||||
|
endif
|
||||||
|
|
||||||
if (-e .defaults) then
|
if (-e .defaults) then
|
||||||
echo ""
|
echo ""
|
||||||
@ -82,7 +88,7 @@ if ($fastrack == 1) then
|
|||||||
if ($status != 0) then
|
if ($status != 0) then
|
||||||
echo "$module is not recognized. To see a list of available modules"
|
echo "$module is not recognized. To see a list of available modules"
|
||||||
echo 'run "Configure" with no arguments.'
|
echo 'run "Configure" with no arguments.'
|
||||||
rm -f $$.[fmn]
|
rm -f $$.[fmna]
|
||||||
exit 1
|
exit 1
|
||||||
endif
|
endif
|
||||||
set random1 = `expr $random + 1`
|
set random1 = `expr $random + 1`
|
||||||
@ -128,7 +134,7 @@ cat <<'EOF'
|
|||||||
|
|
||||||
The following machine-dependent modules are available:
|
The following machine-dependent modules are available:
|
||||||
'EOF'
|
'EOF'
|
||||||
awk -F: ' { printf "%-8s %s\n", $1, $2 }' SYNOPSIS
|
awk -F: ' { printf "%-10s %s\n", $1, $2 }' SYNOPSIS
|
||||||
echo ''
|
echo ''
|
||||||
./getans "What module is appropriate for this machine? " string "$module" .$$
|
./getans "What module is appropriate for this machine? " string "$module" .$$
|
||||||
set module = `cat .$$`
|
set module = `cat .$$`
|
||||||
@ -256,9 +262,16 @@ set delay = `cat .$$`
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
set rand = 0
|
set rand = 0
|
||||||
ypwhich >&/dev/null
|
if (-e /etc/nsswitch.conf) then
|
||||||
if ($status == 0 || -e /etc/passwd.dir || -e /etc/pwd.db) then
|
set rand = `grep '^passwd:.*nis' /etc/nsswitch.conf | wc -l`
|
||||||
set rand = 1
|
if ($rand > 1) then
|
||||||
|
set rand = 1
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ypwhich >&/dev/null
|
||||||
|
if ($status == 0 || -e /etc/passwd.dir || -e /etc/pwd.db) then
|
||||||
|
set rand = 1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ($rand == 1) then
|
if ($rand == 1) then
|
||||||
@ -293,8 +306,15 @@ if ($status == 0) then
|
|||||||
set cnt = `wc -l </tmp/$$.a`
|
set cnt = `wc -l </tmp/$$.a`
|
||||||
set mapfile = "NIS map"
|
set mapfile = "NIS map"
|
||||||
else
|
else
|
||||||
set cnt = `wc -l </etc/passwd`
|
rm /tmp/$$.a
|
||||||
set mapfile = "file"
|
niscat passwd.org_dir >&/tmp/$$.a
|
||||||
|
if ($status == 0) then
|
||||||
|
set cnt = `wc -l </tmp/$$.a`
|
||||||
|
set mapfile = "NISPLUS map"
|
||||||
|
else
|
||||||
|
set cnt = `wc -l </etc/passwd`
|
||||||
|
set mapfile = "file"
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
rm /tmp/$$.a
|
rm /tmp/$$.a
|
||||||
set double = `expr $cnt \* 2`
|
set double = `expr $cnt \* 2`
|
||||||
@ -335,18 +355,37 @@ set t_owner = root
|
|||||||
set t_group = `$ls -d /usr/bin | awk ' { print $4 }'`
|
set t_group = `$ls -d /usr/bin | awk ' { print $4 }'`
|
||||||
if (-e /proc) then
|
if (-e /proc) then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Uh oh! I see /proc out there. Some new Unix variants provide the /proc
|
I see /proc out there. Many Unix variants provide the /proc file
|
||||||
file system as a mechanism to get to a process's address space. This
|
system as a mechanism to get to a process's address space. This
|
||||||
directory is typically only accessible by root. However, there are a few
|
directory is typically only accessible by root. However, there are a
|
||||||
systems (such as DG/UX) on which this directory exists, but isn't used.
|
few systems (such as DG/UX) on which this directory exists, but isn't
|
||||||
I'm going to assume that top needs to run setuid to root, but you should
|
used.
|
||||||
double check and use mode 2755 (set group id) if top doesn't really need
|
|
||||||
root access. If you are running SunOS 5.x then you will need to install
|
|
||||||
top setuid root (owner root and mode 4711).
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
set t_mode = 4711
|
if (-r /proc/0/psinfo) then
|
||||||
set mode = 4711
|
set t_mode = 2711
|
||||||
|
set mode = 2711
|
||||||
|
set t_group = sys
|
||||||
|
set group = sys
|
||||||
|
cat <<EOF
|
||||||
|
It looks like this system is running Solaris 2.6 or greater. If this
|
||||||
|
is the case, then top can function just fine installed set group id to
|
||||||
|
sys. It does not need to be installed set-uid to root.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
set t_mode = 4711
|
||||||
|
set mode = 4711
|
||||||
|
cat <<EOF
|
||||||
|
I'm going to assume that top needs to run setuid to root, but you
|
||||||
|
should double check and use mode 2755 (set group id) if top doesn't
|
||||||
|
really need root access. If you are running SunOS 5.0 through SunOS
|
||||||
|
5.5.1 (that's Solaris 2.0 through Solaris 2.5.1) then you will need to
|
||||||
|
install top setuid root (owner root and mode 4711). In SunOS 5.6
|
||||||
|
and higher top only requires set group id sys permissions.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
endif
|
||||||
else if (-e /dev/kmem) then
|
else if (-e /dev/kmem) then
|
||||||
$ls /dev/kmem >/tmp/$$.b
|
$ls /dev/kmem >/tmp/$$.b
|
||||||
grep '^....r..r..' /tmp/$$.b >&/dev/null
|
grep '^....r..r..' /tmp/$$.b >&/dev/null
|
||||||
@ -404,13 +443,14 @@ echo "We are done with the questions."
|
|||||||
# Some Unix environments are so poor that their csh doesn't even support
|
# Some Unix environments are so poor that their csh doesn't even support
|
||||||
# the "eval" builtin. Check for this before relying on its use to save
|
# the "eval" builtin. Check for this before relying on its use to save
|
||||||
# the current configuration.
|
# the current configuration.
|
||||||
/bin/csh -c "eval echo foo" >&/dev/null
|
/bin/csh -fc "eval echo foo" >&/dev/null
|
||||||
if ($status == 1) then
|
if ($status == 1) then
|
||||||
echo "Can't save configuration (nonfatal)"
|
echo "Can't save configuration (nonfatal)"
|
||||||
else
|
else
|
||||||
echo "Saving configuration..."
|
echo "Saving configuration..."
|
||||||
# save settings to use as defaults the next time
|
# save settings to use as defaults the next time
|
||||||
rm -f .defaults
|
rm -f .defaults
|
||||||
|
touch .defaults
|
||||||
foreach v ($vars)
|
foreach v ($vars)
|
||||||
set tmp = `eval echo \$$v`
|
set tmp = `eval echo \$$v`
|
||||||
echo set $v = "'$tmp'" >>.defaults
|
echo set $v = "'$tmp'" >>.defaults
|
||||||
@ -419,12 +459,8 @@ endif
|
|||||||
|
|
||||||
fast:
|
fast:
|
||||||
|
|
||||||
# set variables which contain module lists
|
|
||||||
set modules = `cat $$.f`
|
|
||||||
set manmodules = `cat $$.m`
|
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
rm -f $$.f $$.m $$.n
|
rm -f $$.[fmna]
|
||||||
|
|
||||||
# set the link for machine.c
|
# set the link for machine.c
|
||||||
rm -f machine.c machine.o
|
rm -f machine.c machine.o
|
||||||
@ -434,10 +470,36 @@ ln -s machine/m_${module}.c machine.c
|
|||||||
set libs = `grep LIBS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
set libs = `grep LIBS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
||||||
set cflgs = `grep CFLAGS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
set cflgs = `grep CFLAGS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
||||||
set tcap = `grep TERMCAP: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
set tcap = `grep TERMCAP: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
||||||
|
set math = `grep MATH: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
||||||
|
|
||||||
|
# get osrev defition, if we can
|
||||||
|
set uname=""
|
||||||
|
if (-e /usr/bin/uname) then
|
||||||
|
set uname=/usr/bin/uname
|
||||||
|
else if (-e /bin/uname) then
|
||||||
|
set uname=/bin/uname
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ("$uname" != "") then
|
||||||
|
# different versions of tr can't agree on the way to specify ranges, so
|
||||||
|
# we will have to give the range explicitly.....sigh.
|
||||||
|
set osrev="-DOSREV=`$uname -r | tr -cd ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`"
|
||||||
|
else
|
||||||
|
set osrev=""
|
||||||
|
endif
|
||||||
|
|
||||||
# default for tcap (termcap)
|
# default for tcap (termcap)
|
||||||
if ("$tcap" == "") then
|
if ("$tcap" == "") then
|
||||||
set tcap="-ltermcap"
|
set tcap="-ltermcap"
|
||||||
|
else if ("$tcap" == "none") then
|
||||||
|
set tcap=""
|
||||||
|
endif
|
||||||
|
|
||||||
|
# allow for the module to override or remove -lm
|
||||||
|
if ("$math" == "") then
|
||||||
|
set math="-lm"
|
||||||
|
else if ("$math" == "none") then
|
||||||
|
set math=""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ( { grep -s SIGKILL /usr/include/signal.h } ) then
|
if ( { grep -s SIGKILL /usr/include/signal.h } ) then
|
||||||
@ -461,14 +523,14 @@ sed -e "s|%topn%|$topn|" \
|
|||||||
-e "s|%libs%|$libs|" \
|
-e "s|%libs%|$libs|" \
|
||||||
-e "s|%cflgs%|$cflgs|" \
|
-e "s|%cflgs%|$cflgs|" \
|
||||||
-e "s|%termcap%|$tcap|" \
|
-e "s|%termcap%|$tcap|" \
|
||||||
|
-e "s|%math%|$math|" \
|
||||||
-e "s|%cdefs%|$cdefs|" \
|
-e "s|%cdefs%|$cdefs|" \
|
||||||
-e "s|%modules%|$modules|" \
|
|
||||||
-e "s|%manmodules%|$manmodules|" \
|
|
||||||
-e "s|%signal%|$signal|" \
|
-e "s|%signal%|$signal|" \
|
||||||
-e "s|%cc%|$Cmdcc|" \
|
-e "s|%cc%|$Cmdcc|" \
|
||||||
-e "s|%awk%|$Cmdawk|" \
|
-e "s|%awk%|$Cmdawk|" \
|
||||||
-e "s|%install%|$Cmdinstall|" \
|
-e "s|%install%|$Cmdinstall|" \
|
||||||
-e "s|%shell%|$Cmdshell|" \
|
-e "s|%shell%|$Cmdshell|" \
|
||||||
|
-e "s|%osrev%|$osrev|" \
|
||||||
Makefile.X >Makefile
|
Makefile.X >Makefile
|
||||||
|
|
||||||
echo "Building top.local.h..."
|
echo "Building top.local.h..."
|
||||||
@ -499,5 +561,5 @@ echo 'To install the executable, type "make install".'
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
byebye:
|
byebye:
|
||||||
rm -f .$$ $$.[fmn] /tmp/$$.[ab]
|
rm -f .$$ $$.[fmna] /tmp/$$.[ab]
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1,30 +1,31 @@
|
|||||||
DISCLAIMER
|
DISCLAIMER
|
||||||
|
|
||||||
"top" is distributed free of charge. It should not be considered an
|
"top" is distributed free of charge. It should not be considered an
|
||||||
official product of Argonne National Laboratory. William LeFebvre
|
official product of Group sys Consulting. William LeFebvre supports
|
||||||
supports "top" in his spare time and as time permits.
|
"top" in his spare time and as time permits.
|
||||||
|
|
||||||
NO WARRANTY:
|
NO WARRANTY:
|
||||||
|
|
||||||
BECAUSE "top" IS DISTRIBUTED FREE OF CHARGE, THERE IS ABSOLUTELY NO
|
BECAUSE "top" IS DISTRIBUTED FREE OF CHARGE, THERE IS ABSOLUTELY NO
|
||||||
WARRANTY PROVIDED, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.
|
WARRANTY PROVIDED, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING, ARGONNE NATIONAL LABORATORY,
|
EXCEPT WHEN OTHERWISE STATED IN WRITING, GROUP SYS CONSULTING, ARGONNE
|
||||||
NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE AND/OR OTHER PARTIES
|
NATIONAL LABORATORY, NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE
|
||||||
PROVIDE "top" "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
AND/OR OTHER PARTIES PROVIDE "top" "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
THE "top" PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
|
PROGRAM IS WITH YOU. SHOULD THE "top" PROGRAM PROVE DEFECTIVE, YOU
|
||||||
NECESSARY SERVICING, REPAIR OR CORRECTION.
|
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
IN NO EVENT WILL ARGONNE NATIONAL LABORATORY, NORTHWESTERN UNIVERSITY,
|
IN NO EVENT WILL GROUP SYS CONSULTING, ARGONNE NATIONAL LABORATORY,
|
||||||
WILLIAM N. LeFEBVRE, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND
|
NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE, AND/OR ANY OTHER PARTY
|
||||||
REDISTRIBUTE "top", BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST
|
WHO MAY MODIFY AND REDISTRIBUTE "top", BE LIABLE TO YOU FOR DAMAGES,
|
||||||
PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL
|
INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL
|
||||||
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
||||||
LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
|
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
|
||||||
SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
|
INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE
|
||||||
OTHER PROGRAMS) THE PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE
|
PROGRAM TO OPERATE WITH OTHER PROGRAMS) THE PROGRAM, EVEN IF YOU HAVE
|
||||||
POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY
|
||||||
|
ANY OTHER PARTY.
|
||||||
|
|
||||||
So there!
|
So there!
|
||||||
|
109
contrib/top/FAQ
109
contrib/top/FAQ
@ -1,8 +1,9 @@
|
|||||||
TOP
|
TOP
|
||||||
Version 3.4
|
Version 3.5
|
||||||
|
Beta Release 11
|
||||||
|
|
||||||
William LeFebvre
|
William LeFebvre
|
||||||
and a cast of dozens
|
with much help from others
|
||||||
|
|
||||||
|
|
||||||
FREQUENTLY ASKED QUESTIONS AND THEIR ANSWERS
|
FREQUENTLY ASKED QUESTIONS AND THEIR ANSWERS
|
||||||
@ -14,40 +15,57 @@ GENERAL
|
|||||||
|
|
||||||
1. "Where do I get the latest version of top?"
|
1. "Where do I get the latest version of top?"
|
||||||
|
|
||||||
The latest version of top is now available at the site "ftp.groupsys.com" in
|
The official site for top is "ftp.groupsys.com" in the directory
|
||||||
the directory "/pub/top". It is also available at "eecs.nwu.edu" in the
|
"/pub/top". It is also available from the following mirror sites:
|
||||||
directory "/pub/top".
|
"pharos.dgim.doc.ca" in /packages/top, "uiarchive.uiuc.edu" in
|
||||||
|
/pub/packages/top, "sunsite.auc.dk" in /pub/unix/top. European
|
||||||
|
users should consider using the Denmark (dk) site.
|
||||||
|
|
||||||
2. "Is there a web page for top?"
|
2. "Is there a web page for top?"
|
||||||
|
|
||||||
Not at this time, but I am planning one. When it is finally available, you
|
Yes. Point your browser at http://www.groupsys.com/top. It includes
|
||||||
will be able to find it at "www.groupsys.com."
|
all documentation, a nice interactive display which describes the
|
||||||
|
various components of the output of top, web-based retrieval of the
|
||||||
|
package, year 2000 information, and pointers to the mailing list.
|
||||||
|
|
||||||
3. "Is there a mailing list for top?"
|
3. "Is there a mailing list for top?"
|
||||||
|
|
||||||
Currently there is a top developers mailing list that is used by beta
|
The official list for announcements is "top-announce@groupsys.com".
|
||||||
testers and other people who help me port the program to various machines.
|
This list is managed by "majordomo@groupsys.com". Announcements of
|
||||||
I am planning a general mailing list for announcements and such, but it is
|
importance to all top users will be sent to this list, including new
|
||||||
not yet available.
|
releases, availability of beta test versions, emergency revisions and
|
||||||
|
patches, etc. Anyone is welcome to join top-announce. This is a
|
||||||
|
read-only list. The list of subscribers will not (intentionally) be
|
||||||
|
made available, and postings to the list are limited.
|
||||||
|
|
||||||
4. "How can I find out when all these things become available?"
|
In addition, there is a top developers mailing list that is used by
|
||||||
|
beta testers and other people who help me port the program to various
|
||||||
|
machines. Membership to this list is solely at my discretion. If you
|
||||||
|
feel qualified to act as a beta tester, or if you are doing development
|
||||||
|
work on top (such as porting to a new platform), you may submit a
|
||||||
|
request by sending a message to "top-spinners-request@groupsys.com"
|
||||||
|
containing the word "subscribe". I will contact you within a few days,
|
||||||
|
as my schedule permits.
|
||||||
|
|
||||||
|
4. "What about Year 2000 compliance"?
|
||||||
|
|
||||||
|
Top should not experience any problems with the transition to the year
|
||||||
|
2000. A full statement concerning top and the year 2000 can be found
|
||||||
|
in the file "Y2K" included with the distribution.
|
||||||
|
|
||||||
Information about the web site and the mailing list will be made available
|
|
||||||
in future distributions of top. New distributions will be announced on the
|
|
||||||
appropriate Usenet newsgroups (including comp.sources.unix).
|
|
||||||
|
|
||||||
5. "Why does it take so long for a new version of top to go through the
|
5. "Why does it take so long for a new version of top to go through the
|
||||||
beta test process?"
|
beta test process?"
|
||||||
|
|
||||||
This is completely my fault. I have just not had the time recently to give
|
This is completely my fault. I have just not had the time to give top
|
||||||
top the attention it deserves. I thank everyone for their patience, and I
|
the attention it deserves. I thank everyone for their patience, and I
|
||||||
hope that with the recent changes in the direction of my career that I can
|
hope that with the recent changes in the direction of my career that I
|
||||||
spend more time on this.
|
can spend more time on this.
|
||||||
|
|
||||||
6. "Top is not written in ANSI C. Do you ever plan to change that?"
|
6. "Top is not written in ANSI C. Do you ever plan to change that?"
|
||||||
|
|
||||||
Top predates ANSI C by about 5 years. Yeah, it'll get "fixed" eventually.
|
Top predates ANSI C by about 5 years. Yeah, it'll get "fixed" eventually.
|
||||||
Probably in 3.5.
|
Probably in 3.6.
|
||||||
|
|
||||||
|
|
||||||
CONFIGURING
|
CONFIGURING
|
||||||
@ -70,7 +88,7 @@ the next release.
|
|||||||
evil?"
|
evil?"
|
||||||
|
|
||||||
They are. :-) I'll probably be rewriting the Configure script for the
|
They are. :-) I'll probably be rewriting the Configure script for the
|
||||||
next release.
|
next release, or switching to something like Gnu configure.
|
||||||
|
|
||||||
|
|
||||||
COMPILING
|
COMPILING
|
||||||
@ -122,14 +140,15 @@ make your window bigger.
|
|||||||
What's wrong?"
|
What's wrong?"
|
||||||
|
|
||||||
Gnu CC likes very much to use its own include files. Not being a gcc
|
Gnu CC likes very much to use its own include files. Not being a gcc
|
||||||
expert, I can't explain why it does this. But I can tell you that if you
|
expert, I can't explain why it does this. But I can tell you that if
|
||||||
upgrade your operating system (say from Solaris 2.4 to Solaris 2.5) after
|
you upgrade your operating system (say from Solaris 2.4 to Solaris
|
||||||
installing gcc, then the include files that gcc uses will be incorrect,
|
2.5) after installing gcc, then the include files that gcc uses will
|
||||||
especially those found in the "sys" directory. Your choices are: (1)
|
be incorrect, especially those found in the "sys" directory. Your
|
||||||
rebuild and reinstall the "standard" include files for gcc (look for a
|
choices are: (1) rebuild and reinstall the "standard" include files
|
||||||
script in the distribution called "fixincludes"), (2) compile machine.c
|
for gcc (look for scripts in the distribution called "fixincludes" and
|
||||||
with "CFLAGS=-I/usr/include" then make the rest of the object files
|
"fixinc.svr4"), (2) compile machine.c with "CFLAGS=-I/usr/include"
|
||||||
normally, or (3) use "cc".
|
then make the rest of the object files normally, or (3) use "cc".
|
||||||
|
Solaris 2.6 users should also consult FAQ #20.
|
||||||
|
|
||||||
14. "The cpu state percentages are all wrong, indicating that my machine is
|
14. "The cpu state percentages are all wrong, indicating that my machine is
|
||||||
using 95% system time when it is clearly idle. What's wrong?"
|
using 95% system time when it is clearly idle. What's wrong?"
|
||||||
@ -187,24 +206,36 @@ top again.
|
|||||||
there when top runs. I figured this was just an oversight. Was I
|
there when top runs. I figured this was just an oversight. Was I
|
||||||
right?"
|
right?"
|
||||||
|
|
||||||
No, you were not right. As distributed, top requires NO alterations for
|
No, you were not right. As distributed, top requires NO alterations
|
||||||
successful compilation and operations under Solaris 2.0, 2.1, 2.2, 2.3, 2.4,
|
for successful compilation and operations under any release of Solaris
|
||||||
and 2.5. You probably compiled top with /usr/ucb/cc instead of the real C
|
2. You probably compiled top with /usr/ucb/cc instead of the real C
|
||||||
compiler. See FAQ #10 for more details.
|
compiler. See FAQ #10 for more details.
|
||||||
|
|
||||||
|
20. "When I try to compile top under Solaris 2.6 using gcc I get compile
|
||||||
|
time errors. There appear to be problems with the include files,
|
||||||
|
such as 'u_rlimit has incomplete type' and/or 'u_saved_rlimit has
|
||||||
|
incomplete type'. I've already run fixinc.svr4 as per FAQ #13.
|
||||||
|
Why didn't that fix it?"
|
||||||
|
|
||||||
|
Only top versions 3.5 and later are compatible with Solaris 2.6. Make
|
||||||
|
sure you are using the most up-to-date version. Earlier beta release
|
||||||
|
copies of version 3.5 had additional problems when compiled with gcc.
|
||||||
|
Retrieve the official version 3.5 (non-beta) release from one of the
|
||||||
|
sites listed in FAQ #1 or FAQ #2.
|
||||||
|
|
||||||
|
|
||||||
SCO PROBLEMS
|
SCO PROBLEMS
|
||||||
|
|
||||||
20. "When I try to run Configure, it complains about a syntax error."
|
21. "When I try to run Configure, it complains about a syntax error."
|
||||||
|
|
||||||
Some versions of SCO's csh do not understand the syntax "$<". This breaks
|
Some versions of SCO's csh do not understand the syntax "$<". Earlier
|
||||||
Configure. You'll just have to hack around it for now: the Configure script
|
releases of top depended on this syntax to read input from the installer's
|
||||||
is going to be completely redone in the near future anyway.
|
terminal during the installation process. Version 3.5 fixes this.
|
||||||
|
|
||||||
|
|
||||||
SVR42 PROBLEMS
|
SVR42 PROBLEMS
|
||||||
|
|
||||||
21. "The load average and memory displays don't work right. Why?"
|
22. "The memory display doesn't work right. Why?"
|
||||||
|
|
||||||
This is a known bug with the svr42 module. The problem has been traced down
|
This is a known bug with the svr42 module. The problem has been traced down
|
||||||
to a potential bug in the "mem" driver. The author of the svr42 module is
|
to a potential bug in the "mem" driver. The author of the svr42 module is
|
||||||
@ -213,7 +244,7 @@ working on a fix.
|
|||||||
|
|
||||||
STILL STUCK
|
STILL STUCK
|
||||||
|
|
||||||
22. I'm still stuck. To whom do I report problems with top?"
|
23. I'm still stuck. To whom do I report problems with top?"
|
||||||
|
|
||||||
The most common problems are caused by top's sensitivity to internal kernel
|
The most common problems are caused by top's sensitivity to internal kernel
|
||||||
data structures. So make sure that you are using the right include files,
|
data structures. So make sure that you are using the right include files,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
TOP
|
TOP
|
||||||
Version 3.4
|
Version 3.5
|
||||||
|
|
||||||
William LeFebvre
|
William LeFebvre
|
||||||
and a cast of dozens
|
and a cast of many
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
|
|
||||||
@ -97,8 +97,9 @@ HINTS FOR CHOOSING THE CORRECT MODULE:
|
|||||||
|
|
||||||
SOLARIS 2.x
|
SOLARIS 2.x
|
||||||
|
|
||||||
For Solaris versions 2.0 thru 2.3, use the module sunos5. For Solaris
|
All versions of Solaris will now work with the module sunos5. Version
|
||||||
versions 2.4 and higher (including 2.5 and 2.5.1) use the module sunos54.
|
specific modules (such as sunos54) no longer exist.
|
||||||
|
|
||||||
|
|
||||||
SUNOS 4.x AND MULTIPROCESSOR ARCHITECTURES
|
SUNOS 4.x AND MULTIPROCESSOR ARCHITECTURES
|
||||||
|
|
||||||
|
@ -4,13 +4,14 @@
|
|||||||
# top's Configure script to build .desc files and the SYNOPSIS file.
|
# top's Configure script to build .desc files and the SYNOPSIS file.
|
||||||
# Configure then uses these files to ask appropriate questions.
|
# Configure then uses these files to ask appropriate questions.
|
||||||
|
|
||||||
# Written by William LeFebvre, Argonne National Laboratory
|
# Written by William LeFebvre, Group sys Consulting
|
||||||
# (formerly of Northwestern University and Rice University)
|
# (formerly of Northwestern University and Rice University)
|
||||||
|
|
||||||
# DO NOT EDIT "Make.desc"!!! Make changes to "Make.desc.X",
|
# DO NOT EDIT "Make.desc"!!! Make changes to "Make.desc.X",
|
||||||
# then "make veryclean", then run "Configure".
|
# then "make veryclean", then run "Configure".
|
||||||
|
|
||||||
DESCS=%descs%
|
# The list of .desc files will be inserted after this next line:
|
||||||
|
DESCS=\
|
||||||
|
|
||||||
.SUFFIXES: .desc
|
.SUFFIXES: .desc
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This makefile is for top, version 3
|
# This makefile is for top, version 3
|
||||||
#
|
#
|
||||||
# Written by William LeFebvre, Argonne National Laboratory
|
# Written by William LeFebvre, Group sys Consulting
|
||||||
# (formerly of Northwestern University and Rice University)
|
# (formerly of Northwestern University and Rice University)
|
||||||
|
|
||||||
# DO NOT EDIT "Makefile"!!!! Make changes to "Makefile.X" and rerun
|
# DO NOT EDIT "Makefile"!!!! Make changes to "Makefile.X" and rerun
|
||||||
@ -45,15 +45,6 @@ SIGNAL = %signal%
|
|||||||
TOPN = %topn%
|
TOPN = %topn%
|
||||||
DELAY = %delay%
|
DELAY = %delay%
|
||||||
|
|
||||||
TARFILES = README INSTALL DISCLAIMER FAQ ADVERTISEMENT \
|
|
||||||
Changes Configure Porting \
|
|
||||||
Makefile.X Make.desc.X getans install \
|
|
||||||
top.c commands.c display.c screen.c username.c \
|
|
||||||
utils.c version.c getopt.c prime.c \
|
|
||||||
boolean.h display.h layout.h loadavg.h screen.h \
|
|
||||||
machine.h patchlevel.h top.h top.local.H os.h utils.h \
|
|
||||||
sigconv.awk top.X m-template metatop \
|
|
||||||
machine
|
|
||||||
CFILES = top.c commands.c display.c screen.c username.c \
|
CFILES = top.c commands.c display.c screen.c username.c \
|
||||||
utils.c version.c getopt.c machine.c
|
utils.c version.c getopt.c machine.c
|
||||||
OBJS = top.o commands.o display.o screen.o username.o \
|
OBJS = top.o commands.o display.o screen.o username.o \
|
||||||
@ -62,6 +53,7 @@ OBJS = top.o commands.o display.o screen.o username.o \
|
|||||||
CDEFS = %cdefs%
|
CDEFS = %cdefs%
|
||||||
LIBS = %libs%
|
LIBS = %libs%
|
||||||
TERMCAP = %termcap%
|
TERMCAP = %termcap%
|
||||||
|
MATH = %math%
|
||||||
|
|
||||||
CFLAGS = %cflgs% $(CDEFS)
|
CFLAGS = %cflgs% $(CDEFS)
|
||||||
LINTFLAGS = -x $(CDEFS)
|
LINTFLAGS = -x $(CDEFS)
|
||||||
@ -78,33 +70,28 @@ top.local.h: top.local.H
|
|||||||
|
|
||||||
top: $(OBJS)
|
top: $(OBJS)
|
||||||
rm -f top
|
rm -f top
|
||||||
$(CC) -o top $(OBJS) $(TERMCAP) -lm $(LIBS)
|
$(CC) $(CDEFS) -o top $(OBJS) $(TERMCAP) $(MATH) $(LIBS)
|
||||||
|
|
||||||
lint: sigdesc.h
|
lint: sigdesc.h
|
||||||
$(LINT) $(LINTFLAGS) $(CFILES)
|
$(LINT) $(LINTFLAGS) $(CFILES)
|
||||||
|
|
||||||
# include file dependencies
|
# include file dependencies
|
||||||
top.o: boolean.h display.h screen.h top.h top.local.h utils.h machine.h
|
top.o: boolean.h display.h screen.h top.h top.local.h utils.h machine.h
|
||||||
commands.o: boolean.h sigdesc.h utils.h
|
commands.o: boolean.h sigdesc.h top.h utils.h
|
||||||
display.o: boolean.h display.h layout.h screen.h top.h top.local.h utils.h
|
display.o: boolean.h display.h layout.h screen.h top.h top.local.h utils.h
|
||||||
machine.o: top.h machine.h utils.h
|
|
||||||
screen.o: boolean.h screen.h
|
screen.o: boolean.h screen.h
|
||||||
utils.o: top.h
|
utils.o: top.h
|
||||||
version.o: top.h patchlevel.h
|
version.o: top.h patchlevel.h
|
||||||
username.o: top.local.h utils.h
|
username.o: top.local.h utils.h
|
||||||
|
|
||||||
|
# when compiling machine.c, include os revision definition
|
||||||
|
machine.o: machine.c top.h machine.h utils.h
|
||||||
|
$(CC) "%osrev%" $(CFLAGS) -c machine.c
|
||||||
|
|
||||||
# automatically built include file
|
# automatically built include file
|
||||||
sigdesc.h: sigconv.awk $(SIGNAL)
|
sigdesc.h: sigconv.awk $(SIGNAL)
|
||||||
$(AWK) -f sigconv.awk $(SIGNAL) >sigdesc.h
|
$(AWK) -f sigconv.awk $(SIGNAL) >sigdesc.h
|
||||||
|
|
||||||
tar:
|
|
||||||
rm -f top.tar machine/*.desc machine/*~
|
|
||||||
tar cvf top.tar $(TARFILES)
|
|
||||||
|
|
||||||
shar:
|
|
||||||
rm -f top.shar* machine/*.desc
|
|
||||||
makekit -ntop.shar. -t"Now read README and INSTALL, then run Configure" machine $(TARFILES)/*
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o top core core.* sigdesc.h
|
rm -f *.o top core core.* sigdesc.h
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ Instructions for porting top to other architectures.
|
|||||||
This is still a preliminary document. Suggestions for improvement are
|
This is still a preliminary document. Suggestions for improvement are
|
||||||
most welcome.
|
most welcome.
|
||||||
|
|
||||||
My address is now "lefebvre@dis.anl.gov".
|
My address is now "wnl@groupsys.com".
|
||||||
|
|
||||||
Before you embark on a port, please send me a mail message telling me
|
Before you embark on a port, please send me a mail message telling me
|
||||||
what platform you are porting top to. There are three reasons for
|
what platform you are porting top to. There are three reasons for
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
TOP
|
TOP
|
||||||
Version 3.4
|
Version 3.5
|
||||||
|
|
||||||
William LeFebvre
|
William LeFebvre
|
||||||
and a cast of dozens
|
and a cast of dozens
|
||||||
@ -69,6 +69,7 @@ Be sure to read the FAQ enclosed with the distrubution. It contains
|
|||||||
answers to the most commonly asked questions about the configuration,
|
answers to the most commonly asked questions about the configuration,
|
||||||
installation, and operation of top.
|
installation, and operation of top.
|
||||||
|
|
||||||
|
|
||||||
AVAILABILITY
|
AVAILABILITY
|
||||||
|
|
||||||
The latest version of "top" is now being made available via anonymous
|
The latest version of "top" is now being made available via anonymous
|
||||||
@ -77,15 +78,26 @@ Additional modules will be made available in the directory
|
|||||||
"/pub/top/m". The site "eecs.nwu.edu" will continue to house copies
|
"/pub/top/m". The site "eecs.nwu.edu" will continue to house copies
|
||||||
of the distribution as well.
|
of the distribution as well.
|
||||||
|
|
||||||
Here are HTML links for the two best "top" archive sites:
|
Here are HTML links for the four best "top" archive sites:
|
||||||
|
|
||||||
<A HREF="ftp://ftp.groupsys.com/pub/top>Top archive (groupsys.com)</A>
|
<A HREF="ftp://ftp.groupsys.com/pub/top">Top archive (groupsys.com)</A>
|
||||||
<A HREF="ftp://eecs.nwu.edu/pub/top>Top archive (eecs.nwu.edu)</A>
|
<A HREF="ftp://eecs.nwu.edu/pub/top">Top archive (eecs.nwu.edu)</A>
|
||||||
|
<A HREF="ftp://pharos.dgim.doc.ca/packages/top"> Top mirror (dgim.doc.ca)</A>
|
||||||
|
<A HREF="ftp://uiarchive.uiuc.edu/pub/packages/top/">Top mirror (uiuc.edu)</A>
|
||||||
|
|
||||||
New releases will be posted to comp.sources.unix as they become
|
New releases will be posted to comp.sources.unix as they become
|
||||||
available. Sites which arhive that newsgroup will also contain copies
|
available. Sites which arhive that newsgroup will also contain copies
|
||||||
of the distribution.
|
of the distribution.
|
||||||
|
|
||||||
|
Announcements about availability will be made to the mailing list
|
||||||
|
"top-announce@groupsys.com". This is an open list maintained by
|
||||||
|
majordomo. To join the list, send a message containing the word
|
||||||
|
"subscribe" to "top-announce-request@groupsys.com". Addresses of
|
||||||
|
subscribers to this list are kept confidential and will never be used
|
||||||
|
for any purpose other than as recipients of announements concerning
|
||||||
|
this software.
|
||||||
|
|
||||||
|
|
||||||
KNOWN PROBLEMS:
|
KNOWN PROBLEMS:
|
||||||
|
|
||||||
Gnu CC
|
Gnu CC
|
||||||
@ -150,7 +162,7 @@ is. Here is a partial list of contributors and other individuals.
|
|||||||
Robert Boucher <boucher@sofkin.ca>
|
Robert Boucher <boucher@sofkin.ca>
|
||||||
Marc Cohen <marc@aai.com>
|
Marc Cohen <marc@aai.com>
|
||||||
David Cutter <dpc@grail.com>
|
David Cutter <dpc@grail.com>
|
||||||
Casper Dik <casper@fwi.uva.nl>
|
Casper Dik <Casper.Dik@Sun.COM>
|
||||||
Charles Hedrick <hedrick@geneva.rutgers.edu>
|
Charles Hedrick <hedrick@geneva.rutgers.edu>
|
||||||
Andrew Herbert <andrew@werple.apana.org.au>
|
Andrew Herbert <andrew@werple.apana.org.au>
|
||||||
Jeff Janvrin <jeff.janvrin@columbiasc.ncr.com>
|
Jeff Janvrin <jeff.janvrin@columbiasc.ncr.com>
|
||||||
@ -173,6 +185,8 @@ AUTHOR
|
|||||||
|
|
||||||
U.S. Mail address:
|
U.S. Mail address:
|
||||||
William LeFebvre
|
William LeFebvre
|
||||||
170 Colton Crest Drive
|
Group sys Consulting
|
||||||
Alpharetta, GA 30202
|
11585 Jones Bridge Road
|
||||||
|
Suite 420-139
|
||||||
|
Alpharetta, GA 30022
|
||||||
(770) 813-3224
|
(770) 813-3224
|
||||||
|
26
contrib/top/Y2K
Normal file
26
contrib/top/Y2K
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Top and the Year 2000
|
||||||
|
|
||||||
|
The software package top will not be affected by years numbering
|
||||||
|
between 2000 and 2037. No portion of the top code stores dates on
|
||||||
|
disk. All date processing in top is performed with functions from the
|
||||||
|
Unix C library and Unix kernel. The specific functions are: time(2)
|
||||||
|
and ctime(3S). These functions deal exclusively with conventional
|
||||||
|
Unix time values (number of seconds since Midnight January 1, 1970
|
||||||
|
GMT) and produce strings with a 4-digit year. At no point in the code
|
||||||
|
for top are the last two digits used to represent a year.
|
||||||
|
|
||||||
|
Top and the Year 2038
|
||||||
|
|
||||||
|
In the year 2038 top will fail to represent the time of day correctly
|
||||||
|
on 32-bit Unix operating systems. This is due to a limitation in the
|
||||||
|
way Unix represents time. Top will only work on systems whose kernel
|
||||||
|
call "time" and C library call "ctime" have been adjusted to represent
|
||||||
|
time with a value greater than 32 bits. The exact date and time of
|
||||||
|
this failure is 3:14:08 January 19, 2038 GMT. Note that this failure
|
||||||
|
will only affect the display of the current time in the output from
|
||||||
|
top.
|
||||||
|
|
||||||
|
|
||||||
|
THERE IS ABSOLUTELY NO WARRANTY PROVIDED WITH THIS SOFTWARE.
|
||||||
|
Please see the contents of the file "DISCLAIMER" for further
|
||||||
|
information.
|
@ -24,6 +24,7 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include "sigdesc.h" /* generated automatically */
|
#include "sigdesc.h" /* generated automatically */
|
||||||
|
#include "top.h"
|
||||||
#include "boolean.h"
|
#include "boolean.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
@ -153,7 +154,7 @@ int *intp;
|
|||||||
|
|
||||||
struct errs /* structure for a system-call error */
|
struct errs /* structure for a system-call error */
|
||||||
{
|
{
|
||||||
int errno; /* value of errno (that is, the actual error) */
|
int errnum; /* value of errno (that is, the actual error) */
|
||||||
char *arg; /* argument that caused the error */
|
char *arg; /* argument that caused the error */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -172,7 +173,7 @@ static char *err_listem =
|
|||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
errs[errcnt].arg = (p); \
|
errs[errcnt].arg = (p); \
|
||||||
errs[errcnt++].errno = (e); \
|
errs[errcnt++].errnum = (e); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -212,7 +213,7 @@ char *err_string()
|
|||||||
while (cnt < errcnt)
|
while (cnt < errcnt)
|
||||||
{
|
{
|
||||||
errp = &(errs[cnt++]);
|
errp = &(errs[cnt++]);
|
||||||
if (errp->errno != currerr)
|
if (errp->errnum != currerr)
|
||||||
{
|
{
|
||||||
if (currerr != -1)
|
if (currerr != -1)
|
||||||
{
|
{
|
||||||
@ -222,7 +223,7 @@ char *err_string()
|
|||||||
}
|
}
|
||||||
(void) strcat(string, "; "); /* we know there's more */
|
(void) strcat(string, "; "); /* we know there's more */
|
||||||
}
|
}
|
||||||
currerr = errp->errno;
|
currerr = errp->errnum;
|
||||||
first = Yes;
|
first = Yes;
|
||||||
}
|
}
|
||||||
if ((stringlen = str_addarg(string, stringlen, errp->arg, first)) ==0)
|
if ((stringlen = str_addarg(string, stringlen, errp->arg, first)) ==0)
|
||||||
@ -310,7 +311,7 @@ register struct errs *p1, *p2;
|
|||||||
{
|
{
|
||||||
register int result;
|
register int result;
|
||||||
|
|
||||||
if ((result = p1->errno - p2->errno) == 0)
|
if ((result = p1->errnum - p2->errnum) == 0)
|
||||||
{
|
{
|
||||||
return(strcmp(p1->arg, p2->arg));
|
return(strcmp(p1->arg, p2->arg));
|
||||||
}
|
}
|
||||||
@ -341,7 +342,7 @@ show_errors()
|
|||||||
while (cnt++ < errcnt)
|
while (cnt++ < errcnt)
|
||||||
{
|
{
|
||||||
printf("%5s: %s\n", errp->arg,
|
printf("%5s: %s\n", errp->arg,
|
||||||
errp->errno == 0 ? "Not a number" : errmsg(errp->errno));
|
errp->errnum == 0 ? "Not a number" : errmsg(errp->errnum));
|
||||||
errp++;
|
errp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,9 +154,9 @@ struct statics *statics;
|
|||||||
ip = cpustate_columns;
|
ip = cpustate_columns;
|
||||||
while (*pp != NULL)
|
while (*pp != NULL)
|
||||||
{
|
{
|
||||||
|
*ip++ = cpustate_total_length;
|
||||||
if ((i = strlen(*pp++)) > 0)
|
if ((i = strlen(*pp++)) > 0)
|
||||||
{
|
{
|
||||||
*ip++ = cpustate_total_length;
|
|
||||||
cpustate_total_length += i + 8;
|
cpustate_total_length += i + 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ time_t *tod;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ltotal = 0;
|
static int ltotal = 0;
|
||||||
static char procstates_buffer[128];
|
static char procstates_buffer[MAX_COLS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* *_procstates(total, brkdn, names) - print the process summary line
|
* *_procstates(total, brkdn, names) - print the process summary line
|
||||||
@ -311,7 +311,7 @@ int total;
|
|||||||
int *brkdn;
|
int *brkdn;
|
||||||
|
|
||||||
{
|
{
|
||||||
static char new[128];
|
static char new[MAX_COLS];
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
/* update number of processes only if it has changed */
|
/* update number of processes only if it has changed */
|
||||||
@ -457,7 +457,7 @@ register int *states;
|
|||||||
((double)value)/10.);
|
((double)value)/10.);
|
||||||
|
|
||||||
/* remember it for next time */
|
/* remember it for next time */
|
||||||
*lp = *states;
|
*lp = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,86 +1,118 @@
|
|||||||
#!/bin/csh -f
|
#!/bin/sh
|
||||||
set ny = (no yes)
|
# getans prompt type default results_filename
|
||||||
if ($2 == "yesno") then
|
# type is one of
|
||||||
@ i = $3 + 1
|
# number
|
||||||
set pmpt = "$1 [$ny[$i]]: "
|
# integer
|
||||||
|
# neginteger
|
||||||
|
# file default=default filename
|
||||||
|
# path
|
||||||
|
# yesno default=0,1 corres yes or no
|
||||||
|
# string (default)
|
||||||
|
|
||||||
|
RAWPMPT=$1
|
||||||
|
TYP=$2
|
||||||
|
DFLT=$3
|
||||||
|
OFNM=$4
|
||||||
|
|
||||||
|
ny0="no"; ny1="yes"
|
||||||
|
if [ ${TYP} = "yesno" ]; then
|
||||||
|
eval ny=\$ny${DFLT}
|
||||||
|
pmpt="${RAWPMPT} [$ny]: "
|
||||||
else
|
else
|
||||||
if ("$3" == "") then
|
if [ -z "${DFLT}" ]; then
|
||||||
set pmpt = "${1}"
|
pmpt="${RAWPMPT}"
|
||||||
else
|
else
|
||||||
set pmpt = "$1 [$3]: "
|
pmpt="${RAWPMPT} [${DFLT}]: "
|
||||||
endif
|
fi
|
||||||
endif
|
fi
|
||||||
rpt:
|
if [ x"`echo -n`" = x-n ]
|
||||||
echo -n "$pmpt"
|
then
|
||||||
set input = $<
|
c=\\c
|
||||||
switch ($2)
|
else
|
||||||
case number:
|
n=-n
|
||||||
set tmp = `echo $input | tr -d 0123456789.`
|
fi
|
||||||
if ("x$tmp" != x) then
|
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
echo $n "$pmpt"$c
|
||||||
|
read input
|
||||||
|
case "$TYP" in
|
||||||
|
number)
|
||||||
|
tmp=`echo $input | tr -d 0123456789.`
|
||||||
|
if [ -n "$tmp" ]; then
|
||||||
echo "Invalid number. Please try again."
|
echo "Invalid number. Please try again."
|
||||||
goto rpt
|
continue
|
||||||
endif
|
fi
|
||||||
breaksw
|
;;
|
||||||
|
|
||||||
case integer:
|
integer)
|
||||||
set tmp = `echo $input | tr -d 0123456789`
|
tmp=`echo $input | tr -d 0123456789`
|
||||||
if ("x$tmp" != x) then
|
if [ -n "$tmp" ]; then
|
||||||
echo "Invalid integer. Please try again."
|
echo "Invalid integer. Please try again."
|
||||||
goto rpt
|
continue
|
||||||
endif
|
fi
|
||||||
breaksw
|
;;
|
||||||
|
|
||||||
case neginteger:
|
neginteger)
|
||||||
if ("x$input" != x-1) then
|
if [ "x$input" != "x-1" ]; then
|
||||||
set tmp = `echo $input | tr -d 0123456789`
|
tmp=`echo $input | tr -d 0123456789`
|
||||||
if ("x$tmp" != x) then
|
if [ -n "$tmp" ]; then
|
||||||
echo "Invalid integer. Please try again."
|
echo "Invalid integer. Please try again."
|
||||||
goto rpt
|
continue
|
||||||
endif
|
fi
|
||||||
endif
|
fi
|
||||||
breaksw
|
;;
|
||||||
|
|
||||||
case file:
|
file)
|
||||||
if ("x$input" == "x") then
|
if [ -z "$input" ]; then
|
||||||
set input = $3
|
input=${DFLT}
|
||||||
endif
|
fi
|
||||||
if (! -e "$input") then
|
if [ ! -f "$input" -a ! -d "$input" ]; then
|
||||||
echo The file $input "does not exist. Please try again."
|
echo "The file $input does not exist. Please try again."
|
||||||
goto rpt
|
continue
|
||||||
endif
|
fi
|
||||||
breaksw
|
;;
|
||||||
|
|
||||||
case path:
|
path)
|
||||||
if ("x$input" == "x") then
|
if [ -z "$input" ]; then
|
||||||
set input = "$3"
|
input="${DFLT}"
|
||||||
endif
|
fi
|
||||||
if (! -e "$input") then
|
if [ ! -f "$input" ]; then
|
||||||
foreach elt ($path)
|
path=`echo $PATH | sed -e s'/::/ . /g' -e 's/:/ /g'`
|
||||||
if (-e "$elt/$input") breaksw
|
x=
|
||||||
end
|
for elt in $path; do
|
||||||
echo The command $input "was not found. Please try again."
|
if [ -f "$elt/$input" ]; then x=1; break; fi
|
||||||
goto rpt
|
done
|
||||||
endif
|
if [ -z "$x" ] ;then
|
||||||
breaksw
|
echo "The command $input was not found. Please try again."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
case yesno:
|
yesno)
|
||||||
if ("x$input" == xy || "x$input" == xyes) then
|
if [ -z "$input" ]; then
|
||||||
set input = 1
|
input="${DFLT}"
|
||||||
else if ("x$input" == xn || "x$input" == xno) then
|
else
|
||||||
set input = 0
|
case $input in
|
||||||
else if ("x$input" != x) then
|
y | yes)
|
||||||
echo 'Please answer "yes" or "no".'
|
input=1 ;;
|
||||||
goto rpt
|
n | no)
|
||||||
endif
|
input=0 ;;
|
||||||
breaksw
|
*)
|
||||||
|
echo 'Please answer "yes" or "no".'
|
||||||
|
continue ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
default:
|
*) ;;
|
||||||
breaksw
|
esac
|
||||||
|
break
|
||||||
|
done
|
||||||
|
|
||||||
endsw
|
if [ -z "$input" ]; then
|
||||||
|
input="${DFLT}"
|
||||||
|
fi
|
||||||
|
|
||||||
if ("x$input" == x) then
|
echo $input > ${OFNM}
|
||||||
set input = "$3"
|
|
||||||
endif
|
|
||||||
|
|
||||||
echo $input > $4
|
|
||||||
|
@ -21,12 +21,18 @@ struct statics
|
|||||||
* the system_info struct is filled in by a machine dependent routine.
|
* the system_info struct is filled in by a machine dependent routine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef p_active /* uw7 define macro p_active */
|
||||||
|
#define P_ACTIVE p_pactive
|
||||||
|
#else
|
||||||
|
#define P_ACTIVE p_active
|
||||||
|
#endif
|
||||||
|
|
||||||
struct system_info
|
struct system_info
|
||||||
{
|
{
|
||||||
int last_pid;
|
int last_pid;
|
||||||
double load_avg[NUM_AVERAGES];
|
double load_avg[NUM_AVERAGES];
|
||||||
int p_total;
|
int p_total;
|
||||||
int p_active; /* number of procs considered "active" */
|
int P_ACTIVE; /* number of procs considered "active" */
|
||||||
int *procstates;
|
int *procstates;
|
||||||
int *cpustates;
|
int *cpustates;
|
||||||
int *memory;
|
int *memory;
|
||||||
|
@ -27,3 +27,12 @@ caddr_t malloc();
|
|||||||
# define memzero(a, b) memset((a), 0, (b))
|
# define memzero(a, b) memset((a), 0, (b))
|
||||||
typedef void sigret_t;
|
typedef void sigret_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* some systems declare sys_errlist in stdio.h! */
|
||||||
|
#if defined(__NetBSD__) || defined(__FreeBSD__)
|
||||||
|
#if !defined(__m68k__)
|
||||||
|
# if !defined(__NetBSD132__)
|
||||||
|
#define SYS_ERRLIST_DECLARED
|
||||||
|
# endif /* __NetBSD132__ */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -1 +1,2 @@
|
|||||||
#define PATCHLEVEL 4
|
#define PATCHLEVEL 5
|
||||||
|
#define BETA "beta12"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* higher than the number specified as argv[1].
|
* higher than the number specified as argv[1].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
|
@ -9,7 +9,7 @@ top \- display and update information about the top cpu processes
|
|||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B top
|
.B top
|
||||||
[
|
[
|
||||||
.B \-SbiInqu
|
.B \-SbiInquv
|
||||||
] [
|
] [
|
||||||
.BI \-d count
|
.BI \-d count
|
||||||
] [
|
] [
|
||||||
@ -100,6 +100,11 @@ all the user id numbers it encounters into login names. This option
|
|||||||
disables all that, while possibly decreasing execution time. The uid
|
disables all that, while possibly decreasing execution time. The uid
|
||||||
numbers are displayed instead of the names.
|
numbers are displayed instead of the names.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-v
|
||||||
|
Write version number information to stderr then exit immediately.
|
||||||
|
No other processing takes place when this option is used. To see current
|
||||||
|
revision information while top is running, use the help command \*(lq?\*(rq.
|
||||||
|
.TP
|
||||||
.BI \-d count
|
.BI \-d count
|
||||||
Show only
|
Show only
|
||||||
.I count
|
.I count
|
||||||
@ -187,7 +192,8 @@ These commands are currently recognized (^L refers to control-L):
|
|||||||
.B ^L
|
.B ^L
|
||||||
Redraw the screen.
|
Redraw the screen.
|
||||||
.IP "\fBh\fP\ or\ \fB?\fP"
|
.IP "\fBh\fP\ or\ \fB?\fP"
|
||||||
Display a summary of the commands (help screen).
|
Display a summary of the commands (help screen). Version information
|
||||||
|
is included in this display.
|
||||||
.TP
|
.TP
|
||||||
.B q
|
.B q
|
||||||
Quit
|
Quit
|
||||||
@ -223,6 +229,12 @@ Display only processes owned by a specific username (prompt for username).
|
|||||||
If the username specified is simply \*(lq+\*(rq, then processes belonging
|
If the username specified is simply \*(lq+\*(rq, then processes belonging
|
||||||
to all users will be displayed.
|
to all users will be displayed.
|
||||||
.TP
|
.TP
|
||||||
|
.B o
|
||||||
|
Change the order in which the display is sorted. This command is not
|
||||||
|
available on all systems. The sort key names vary fron system to system
|
||||||
|
but usually include: \*(lqcpu\*(rq, \*(lqres\*(rq, \*(lqsize\*(rq,
|
||||||
|
\*(lqtime\*(rq. The default is cpu.
|
||||||
|
.TP
|
||||||
.B e
|
.B e
|
||||||
Display a list of system errors (if any) generated by the last
|
Display a list of system errors (if any) generated by the last
|
||||||
.BR k ill
|
.BR k ill
|
||||||
|
@ -9,7 +9,9 @@ char *copyright =
|
|||||||
* but this entire comment MUST remain intact.
|
* but this entire comment MUST remain intact.
|
||||||
*
|
*
|
||||||
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
||||||
* Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
|
* Copyright (c) 1989 - 1994, William LeFebvre, Northwestern University
|
||||||
|
* Copyright (c) 1994, 1995, William LeFebvre, Argonne National Laboratory
|
||||||
|
* Copyright (c) 1996, William LeFebvre, Group sys Consulting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -53,9 +55,6 @@ char stdoutbuf[Buffersize];
|
|||||||
/* build Signal masks */
|
/* build Signal masks */
|
||||||
#define Smask(s) (1 << ((s) - 1))
|
#define Smask(s) (1 << ((s) - 1))
|
||||||
|
|
||||||
/* for system errors */
|
|
||||||
extern int errno;
|
|
||||||
|
|
||||||
/* for getopt: */
|
/* for getopt: */
|
||||||
extern int optind;
|
extern int optind;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
@ -177,7 +176,7 @@ char *argv[];
|
|||||||
/* FD_SET and friends are not present: fake it */
|
/* FD_SET and friends are not present: fake it */
|
||||||
typedef int fd_set;
|
typedef int fd_set;
|
||||||
#define FD_ZERO(x) (*(x) = 0)
|
#define FD_ZERO(x) (*(x) = 0)
|
||||||
#define FD_SET(f, x) (*(x) = f)
|
#define FD_SET(f, x) (*(x) = 1<<f)
|
||||||
#endif
|
#endif
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
|
|
||||||
@ -209,6 +208,8 @@ char *argv[];
|
|||||||
|
|
||||||
/* set the buffer for stdout */
|
/* set the buffer for stdout */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
extern FILE *debug;
|
||||||
|
debug = fopen("debug.run", "w");
|
||||||
setbuffer(stdout, NULL, 0);
|
setbuffer(stdout, NULL, 0);
|
||||||
#else
|
#else
|
||||||
setbuffer(stdout, stdoutbuf, Buffersize);
|
setbuffer(stdout, stdoutbuf, Buffersize);
|
||||||
@ -256,10 +257,16 @@ char *argv[];
|
|||||||
optind = 1;
|
optind = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((i = getopt(ac, av, "SIbinqus:d:U:o:")) != EOF)
|
while ((i = getopt(ac, av, "SIbinquvs:d:U:o:")) != EOF)
|
||||||
{
|
{
|
||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
|
case 'v': /* show version number */
|
||||||
|
fprintf(stderr, "%s: version %s\n",
|
||||||
|
myname, version_string());
|
||||||
|
exit(1);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'u': /* toggle uid/username display */
|
case 'u': /* toggle uid/username display */
|
||||||
do_unames = !do_unames;
|
do_unames = !do_unames;
|
||||||
break;
|
break;
|
||||||
@ -304,10 +311,10 @@ char *argv[];
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
if ((delay = atoi(optarg)) < 0)
|
if ((delay = atoi(optarg)) < 0 || (delay == 0 && getuid() != 0))
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: warning: seconds delay should be non-negative -- using default\n",
|
"%s: warning: seconds delay should be positive -- using default\n",
|
||||||
myname);
|
myname);
|
||||||
delay = Default_DELAY;
|
delay = Default_DELAY;
|
||||||
warnings++;
|
warnings++;
|
||||||
@ -579,7 +586,7 @@ Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n",
|
|||||||
/* determine number of processes to actually display */
|
/* determine number of processes to actually display */
|
||||||
/* this number will be the smallest of: active processes,
|
/* this number will be the smallest of: active processes,
|
||||||
number user requested, number current screen accomodates */
|
number user requested, number current screen accomodates */
|
||||||
active_procs = system_info.p_active;
|
active_procs = system_info.P_ACTIVE;
|
||||||
if (active_procs > topn)
|
if (active_procs > topn)
|
||||||
{
|
{
|
||||||
active_procs = topn;
|
active_procs = topn;
|
||||||
@ -604,7 +611,13 @@ Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n",
|
|||||||
u_endscreen(i);
|
u_endscreen(i);
|
||||||
|
|
||||||
/* now, flush the output buffer */
|
/* now, flush the output buffer */
|
||||||
fflush(stdout);
|
if (fflush(stdout) != 0)
|
||||||
|
{
|
||||||
|
new_message(MT_standout, " Write error on stdout");
|
||||||
|
putchar('\r');
|
||||||
|
quit(1);
|
||||||
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
|
|
||||||
/* only do the rest if we have more displays to show */
|
/* only do the rest if we have more displays to show */
|
||||||
if (displays)
|
if (displays)
|
||||||
@ -645,7 +658,7 @@ Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n",
|
|||||||
|
|
||||||
/* set up arguments for select with timeout */
|
/* set up arguments for select with timeout */
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
FD_SET(1, &readfds); /* for standard input */
|
FD_SET(0, &readfds); /* for standard input */
|
||||||
timeout.tv_sec = delay;
|
timeout.tv_sec = delay;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
@ -660,7 +673,14 @@ Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n",
|
|||||||
|
|
||||||
/* now read it and convert to command strchr */
|
/* now read it and convert to command strchr */
|
||||||
/* (use "change" as a temporary to hold strchr) */
|
/* (use "change" as a temporary to hold strchr) */
|
||||||
(void) read(0, &ch, 1);
|
if (read(0, &ch, 1) != 1)
|
||||||
|
{
|
||||||
|
/* read error: either 0 or -1 */
|
||||||
|
new_message(MT_standout, " Read error on stdin");
|
||||||
|
putchar('\r');
|
||||||
|
quit(1);
|
||||||
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
if ((iptr = strchr(command_chars, ch)) == NULL)
|
if ((iptr = strchr(command_chars, ch)) == NULL)
|
||||||
{
|
{
|
||||||
/* illegal command */
|
/* illegal command */
|
||||||
@ -763,7 +783,10 @@ Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n",
|
|||||||
new_message(MT_standout, "Seconds to delay: ");
|
new_message(MT_standout, "Seconds to delay: ");
|
||||||
if ((i = readline(tempbuf1, 8, Yes)) > -1)
|
if ((i = readline(tempbuf1, 8, Yes)) > -1)
|
||||||
{
|
{
|
||||||
delay = i;
|
if ((delay = i) == 0 && getuid() != 0)
|
||||||
|
{
|
||||||
|
delay = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
clear_message();
|
clear_message();
|
||||||
break;
|
break;
|
||||||
@ -893,6 +916,9 @@ Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fclose(debug);
|
||||||
|
#endif
|
||||||
quit(0);
|
quit(0);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
@ -320,27 +320,42 @@ long *diffs;
|
|||||||
/*
|
/*
|
||||||
* errmsg(errnum) - return an error message string appropriate to the
|
* errmsg(errnum) - return an error message string appropriate to the
|
||||||
* error number "errnum". This is a substitute for the System V
|
* error number "errnum". This is a substitute for the System V
|
||||||
* function "strerror" with one important difference: the string
|
* function "strerror". There appears to be no reliable way to
|
||||||
* returned by this function does NOT end in a newline!
|
* determine if "strerror" exists at compile time, so I make do
|
||||||
* N.B.: there appears to be no reliable way to determine if
|
* by providing something of similar functionality. For those
|
||||||
* "strerror" exists at compile time, so I make do by providing
|
* systems that have strerror and NOT errlist, define
|
||||||
* something of similar functionality.
|
* -DHAVE_STRERROR in the module file and this function will
|
||||||
|
* use strerror.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* externs referenced by errmsg */
|
/* externs referenced by errmsg */
|
||||||
|
|
||||||
|
#ifndef HAVE_STRERROR
|
||||||
|
#ifndef SYS_ERRLIST_DECLARED
|
||||||
|
#define SYS_ERRLIST_DECLARED
|
||||||
extern char *sys_errlist[];
|
extern char *sys_errlist[];
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int sys_nerr;
|
extern int sys_nerr;
|
||||||
|
#endif
|
||||||
|
|
||||||
char *errmsg(errnum)
|
char *errmsg(errnum)
|
||||||
|
|
||||||
int errnum;
|
int errnum;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_STRERROR
|
||||||
|
char *msg = strerror(errnum);
|
||||||
|
if (msg != NULL)
|
||||||
|
{
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (errnum > 0 && errnum < sys_nerr)
|
if (errnum > 0 && errnum < sys_nerr)
|
||||||
{
|
{
|
||||||
return(sys_errlist[errnum]);
|
return(sys_errlist[errnum]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return("No error");
|
return("No error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user