import top_3_5beta12
This commit is contained in:
parent
1b9d0472b7
commit
6d85e91806
@ -11,7 +11,8 @@ through the company Group sys Consulting. William's specialties are:
|
||||
Local area network design
|
||||
Design of safe connections to the Internet
|
||||
Domain Name Service
|
||||
Unix and Internet security
|
||||
Threaded programming with pthreads
|
||||
Netscape Server API plugins
|
||||
INN news server configuration
|
||||
SunOS to Solaris migration
|
||||
Troubleshooting
|
||||
@ -23,4 +24,5 @@ other countries can be arranged as well.
|
||||
|
||||
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".
|
||||
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)
|
||||
Replaced modules (from Tim Pugh): next 32, next40.
|
||||
Fixed bug in username.c: hashing negative uids.
|
||||
|
@ -25,7 +25,7 @@ if ($#argv > 0) then
|
||||
set fastrack = 1
|
||||
else
|
||||
cat <<'EOF'
|
||||
Configuration for top, version 3.4
|
||||
Configuration for top, version 3.5
|
||||
|
||||
One moment....
|
||||
'EOF'
|
||||
@ -37,11 +37,17 @@ ls machine/m_*.man >$$.m
|
||||
sed -e 's@^machine/m_@@' -e 's/.c$//' $$.f >$$.n
|
||||
|
||||
# build Make.desc
|
||||
set descs = `sed -e 's@\.c$@.desc@' $$.f`
|
||||
sed -e "s@%descs%@$descs@" Make.desc.X >Make.desc
|
||||
sed -e 's@\.c@.desc\\@' $$.f | sed -e '$s/\\//' >$$.a
|
||||
sed -e "/^DESCS/r $$.a" Make.desc.X >Make.desc
|
||||
|
||||
# build desc files and SYNOPSIS as needed
|
||||
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
|
||||
echo ""
|
||||
@ -82,7 +88,7 @@ if ($fastrack == 1) then
|
||||
if ($status != 0) then
|
||||
echo "$module is not recognized. To see a list of available modules"
|
||||
echo 'run "Configure" with no arguments.'
|
||||
rm -f $$.[fmn]
|
||||
rm -f $$.[fmna]
|
||||
exit 1
|
||||
endif
|
||||
set random1 = `expr $random + 1`
|
||||
@ -128,7 +134,7 @@ cat <<'EOF'
|
||||
|
||||
The following machine-dependent modules are available:
|
||||
'EOF'
|
||||
awk -F: ' { printf "%-8s %s\n", $1, $2 }' SYNOPSIS
|
||||
awk -F: ' { printf "%-10s %s\n", $1, $2 }' SYNOPSIS
|
||||
echo ''
|
||||
./getans "What module is appropriate for this machine? " string "$module" .$$
|
||||
set module = `cat .$$`
|
||||
@ -256,9 +262,16 @@ set delay = `cat .$$`
|
||||
echo ""
|
||||
|
||||
set rand = 0
|
||||
ypwhich >&/dev/null
|
||||
if ($status == 0 || -e /etc/passwd.dir || -e /etc/pwd.db) then
|
||||
set rand = 1
|
||||
if (-e /etc/nsswitch.conf) then
|
||||
set rand = `grep '^passwd:.*nis' /etc/nsswitch.conf | wc -l`
|
||||
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
|
||||
|
||||
if ($rand == 1) then
|
||||
@ -293,8 +306,15 @@ if ($status == 0) then
|
||||
set cnt = `wc -l </tmp/$$.a`
|
||||
set mapfile = "NIS map"
|
||||
else
|
||||
set cnt = `wc -l </etc/passwd`
|
||||
set mapfile = "file"
|
||||
rm /tmp/$$.a
|
||||
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
|
||||
rm /tmp/$$.a
|
||||
set double = `expr $cnt \* 2`
|
||||
@ -335,18 +355,37 @@ set t_owner = root
|
||||
set t_group = `$ls -d /usr/bin | awk ' { print $4 }'`
|
||||
if (-e /proc) then
|
||||
cat <<EOF
|
||||
Uh oh! I see /proc out there. Some new Unix variants provide the /proc
|
||||
file 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
|
||||
systems (such as DG/UX) on which this directory exists, but isn't used.
|
||||
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.x then you will need to install
|
||||
top setuid root (owner root and mode 4711).
|
||||
I see /proc out there. Many Unix variants provide the /proc file
|
||||
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 systems (such as DG/UX) on which this directory exists, but isn't
|
||||
used.
|
||||
|
||||
EOF
|
||||
set t_mode = 4711
|
||||
set mode = 4711
|
||||
if (-r /proc/0/psinfo) then
|
||||
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
|
||||
$ls /dev/kmem >/tmp/$$.b
|
||||
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
|
||||
# the "eval" builtin. Check for this before relying on its use to save
|
||||
# the current configuration.
|
||||
/bin/csh -c "eval echo foo" >&/dev/null
|
||||
/bin/csh -fc "eval echo foo" >&/dev/null
|
||||
if ($status == 1) then
|
||||
echo "Can't save configuration (nonfatal)"
|
||||
else
|
||||
echo "Saving configuration..."
|
||||
# save settings to use as defaults the next time
|
||||
rm -f .defaults
|
||||
touch .defaults
|
||||
foreach v ($vars)
|
||||
set tmp = `eval echo \$$v`
|
||||
echo set $v = "'$tmp'" >>.defaults
|
||||
@ -419,12 +459,8 @@ endif
|
||||
|
||||
fast:
|
||||
|
||||
# set variables which contain module lists
|
||||
set modules = `cat $$.f`
|
||||
set manmodules = `cat $$.m`
|
||||
|
||||
# clean up
|
||||
rm -f $$.f $$.m $$.n
|
||||
rm -f $$.[fmna]
|
||||
|
||||
# set the link for machine.c
|
||||
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 cflgs = `grep CFLAGS: 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)
|
||||
if ("$tcap" == "") then
|
||||
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
|
||||
|
||||
if ( { grep -s SIGKILL /usr/include/signal.h } ) then
|
||||
@ -461,14 +523,14 @@ sed -e "s|%topn%|$topn|" \
|
||||
-e "s|%libs%|$libs|" \
|
||||
-e "s|%cflgs%|$cflgs|" \
|
||||
-e "s|%termcap%|$tcap|" \
|
||||
-e "s|%math%|$math|" \
|
||||
-e "s|%cdefs%|$cdefs|" \
|
||||
-e "s|%modules%|$modules|" \
|
||||
-e "s|%manmodules%|$manmodules|" \
|
||||
-e "s|%signal%|$signal|" \
|
||||
-e "s|%cc%|$Cmdcc|" \
|
||||
-e "s|%awk%|$Cmdawk|" \
|
||||
-e "s|%install%|$Cmdinstall|" \
|
||||
-e "s|%shell%|$Cmdshell|" \
|
||||
-e "s|%osrev%|$osrev|" \
|
||||
Makefile.X >Makefile
|
||||
|
||||
echo "Building top.local.h..."
|
||||
@ -499,5 +561,5 @@ echo 'To install the executable, type "make install".'
|
||||
exit 0
|
||||
|
||||
byebye:
|
||||
rm -f .$$ $$.[fmn] /tmp/$$.[ab]
|
||||
rm -f .$$ $$.[fmna] /tmp/$$.[ab]
|
||||
exit 1
|
||||
|
@ -1,30 +1,31 @@
|
||||
DISCLAIMER
|
||||
|
||||
"top" is distributed free of charge. It should not be considered an
|
||||
official product of Argonne National Laboratory. William LeFebvre
|
||||
supports "top" in his spare time and as time permits.
|
||||
official product of Group sys Consulting. William LeFebvre supports
|
||||
"top" in his spare time and as time permits.
|
||||
|
||||
NO WARRANTY:
|
||||
|
||||
BECAUSE "top" IS DISTRIBUTED FREE OF CHARGE, THERE IS ABSOLUTELY NO
|
||||
WARRANTY PROVIDED, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING, ARGONNE NATIONAL LABORATORY,
|
||||
NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE AND/OR OTHER PARTIES
|
||||
PROVIDE "top" "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
|
||||
AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
|
||||
THE "top" PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
|
||||
NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING, GROUP SYS CONSULTING, ARGONNE
|
||||
NATIONAL LABORATORY, NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE
|
||||
AND/OR OTHER PARTIES PROVIDE "top" "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
PROGRAM IS WITH YOU. SHOULD THE "top" PROGRAM PROVE DEFECTIVE, YOU
|
||||
ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
IN NO EVENT WILL ARGONNE NATIONAL LABORATORY, NORTHWESTERN UNIVERSITY,
|
||||
WILLIAM N. LeFEBVRE, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND
|
||||
REDISTRIBUTE "top", BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST
|
||||
PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL
|
||||
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT
|
||||
LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
|
||||
SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
|
||||
OTHER PROGRAMS) THE PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
|
||||
IN NO EVENT WILL GROUP SYS CONSULTING, ARGONNE NATIONAL LABORATORY,
|
||||
NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE, AND/OR ANY OTHER PARTY
|
||||
WHO MAY MODIFY AND REDISTRIBUTE "top", BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
||||
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
|
||||
INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE
|
||||
PROGRAM TO OPERATE WITH OTHER PROGRAMS) THE PROGRAM, EVEN IF YOU HAVE
|
||||
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY
|
||||
ANY OTHER PARTY.
|
||||
|
||||
So there!
|
||||
|
109
contrib/top/FAQ
109
contrib/top/FAQ
@ -1,8 +1,9 @@
|
||||
TOP
|
||||
Version 3.4
|
||||
Version 3.5
|
||||
Beta Release 11
|
||||
|
||||
William LeFebvre
|
||||
and a cast of dozens
|
||||
with much help from others
|
||||
|
||||
|
||||
FREQUENTLY ASKED QUESTIONS AND THEIR ANSWERS
|
||||
@ -14,40 +15,57 @@ GENERAL
|
||||
|
||||
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 directory "/pub/top". It is also available at "eecs.nwu.edu" in the
|
||||
directory "/pub/top".
|
||||
|
||||
The official site for top is "ftp.groupsys.com" in the directory
|
||||
"/pub/top". It is also available from the following mirror sites:
|
||||
"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?"
|
||||
|
||||
Not at this time, but I am planning one. When it is finally available, you
|
||||
will be able to find it at "www.groupsys.com."
|
||||
Yes. Point your browser at http://www.groupsys.com/top. It includes
|
||||
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?"
|
||||
|
||||
Currently 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.
|
||||
I am planning a general mailing list for announcements and such, but it is
|
||||
not yet available.
|
||||
The official list for announcements is "top-announce@groupsys.com".
|
||||
This list is managed by "majordomo@groupsys.com". Announcements of
|
||||
importance to all top users will be sent to this list, including new
|
||||
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
|
||||
beta test process?"
|
||||
|
||||
This is completely my fault. I have just not had the time recently to give
|
||||
top 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
|
||||
spend more time on this.
|
||||
This is completely my fault. I have just not had the time to give top
|
||||
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 spend more time on this.
|
||||
|
||||
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.
|
||||
Probably in 3.5.
|
||||
Probably in 3.6.
|
||||
|
||||
|
||||
CONFIGURING
|
||||
@ -70,7 +88,7 @@ the next release.
|
||||
evil?"
|
||||
|
||||
They are. :-) I'll probably be rewriting the Configure script for the
|
||||
next release.
|
||||
next release, or switching to something like Gnu configure.
|
||||
|
||||
|
||||
COMPILING
|
||||
@ -122,14 +140,15 @@ make your window bigger.
|
||||
What's wrong?"
|
||||
|
||||
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
|
||||
upgrade your operating system (say from Solaris 2.4 to Solaris 2.5) after
|
||||
installing gcc, then the include files that gcc uses will be incorrect,
|
||||
especially those found in the "sys" directory. Your choices are: (1)
|
||||
rebuild and reinstall the "standard" include files for gcc (look for a
|
||||
script in the distribution called "fixincludes"), (2) compile machine.c
|
||||
with "CFLAGS=-I/usr/include" then make the rest of the object files
|
||||
normally, or (3) use "cc".
|
||||
expert, I can't explain why it does this. But I can tell you that if
|
||||
you upgrade your operating system (say from Solaris 2.4 to Solaris
|
||||
2.5) after installing gcc, then the include files that gcc uses will
|
||||
be incorrect, especially those found in the "sys" directory. Your
|
||||
choices are: (1) rebuild and reinstall the "standard" include files
|
||||
for gcc (look for scripts in the distribution called "fixincludes" and
|
||||
"fixinc.svr4"), (2) compile machine.c with "CFLAGS=-I/usr/include"
|
||||
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
|
||||
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
|
||||
right?"
|
||||
|
||||
No, you were not right. As distributed, top requires NO alterations for
|
||||
successful compilation and operations under Solaris 2.0, 2.1, 2.2, 2.3, 2.4,
|
||||
and 2.5. You probably compiled top with /usr/ucb/cc instead of the real C
|
||||
No, you were not right. As distributed, top requires NO alterations
|
||||
for successful compilation and operations under any release of Solaris
|
||||
2. You probably compiled top with /usr/ucb/cc instead of the real C
|
||||
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
|
||||
|
||||
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
|
||||
Configure. You'll just have to hack around it for now: the Configure script
|
||||
is going to be completely redone in the near future anyway.
|
||||
Some versions of SCO's csh do not understand the syntax "$<". Earlier
|
||||
releases of top depended on this syntax to read input from the installer's
|
||||
terminal during the installation process. Version 3.5 fixes this.
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
data structures. So make sure that you are using the right include files,
|
||||
|
@ -1,8 +1,8 @@
|
||||
TOP
|
||||
Version 3.4
|
||||
Version 3.5
|
||||
|
||||
William LeFebvre
|
||||
and a cast of dozens
|
||||
and a cast of many
|
||||
|
||||
INSTALLATION
|
||||
|
||||
@ -97,8 +97,9 @@ HINTS FOR CHOOSING THE CORRECT MODULE:
|
||||
|
||||
SOLARIS 2.x
|
||||
|
||||
For Solaris versions 2.0 thru 2.3, use the module sunos5. For Solaris
|
||||
versions 2.4 and higher (including 2.5 and 2.5.1) use the module sunos54.
|
||||
All versions of Solaris will now work with the module sunos5. Version
|
||||
specific modules (such as sunos54) no longer exist.
|
||||
|
||||
|
||||
SUNOS 4.x AND MULTIPROCESSOR ARCHITECTURES
|
||||
|
||||
|
@ -4,13 +4,14 @@
|
||||
# top's Configure script to build .desc files and the SYNOPSIS file.
|
||||
# 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)
|
||||
|
||||
# DO NOT EDIT "Make.desc"!!! Make changes to "Make.desc.X",
|
||||
# then "make veryclean", then run "Configure".
|
||||
|
||||
DESCS=%descs%
|
||||
# The list of .desc files will be inserted after this next line:
|
||||
DESCS=\
|
||||
|
||||
.SUFFIXES: .desc
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# 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)
|
||||
|
||||
# DO NOT EDIT "Makefile"!!!! Make changes to "Makefile.X" and rerun
|
||||
@ -45,15 +45,6 @@ SIGNAL = %signal%
|
||||
TOPN = %topn%
|
||||
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 \
|
||||
utils.c version.c getopt.c machine.c
|
||||
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%
|
||||
LIBS = %libs%
|
||||
TERMCAP = %termcap%
|
||||
MATH = %math%
|
||||
|
||||
CFLAGS = %cflgs% $(CDEFS)
|
||||
LINTFLAGS = -x $(CDEFS)
|
||||
@ -78,33 +70,28 @@ top.local.h: top.local.H
|
||||
|
||||
top: $(OBJS)
|
||||
rm -f top
|
||||
$(CC) -o top $(OBJS) $(TERMCAP) -lm $(LIBS)
|
||||
$(CC) $(CDEFS) -o top $(OBJS) $(TERMCAP) $(MATH) $(LIBS)
|
||||
|
||||
lint: sigdesc.h
|
||||
$(LINT) $(LINTFLAGS) $(CFILES)
|
||||
|
||||
# include file dependencies
|
||||
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
|
||||
machine.o: top.h machine.h utils.h
|
||||
screen.o: boolean.h screen.h
|
||||
utils.o: top.h
|
||||
version.o: top.h patchlevel.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
|
||||
sigdesc.h: sigconv.awk $(SIGNAL)
|
||||
$(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:
|
||||
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
|
||||
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
|
||||
what platform you are porting top to. There are three reasons for
|
||||
|
@ -1,5 +1,5 @@
|
||||
TOP
|
||||
Version 3.4
|
||||
Version 3.5
|
||||
|
||||
William LeFebvre
|
||||
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,
|
||||
installation, and operation of top.
|
||||
|
||||
|
||||
AVAILABILITY
|
||||
|
||||
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
|
||||
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://eecs.nwu.edu/pub/top>Top archive (eecs.nwu.edu)</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://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
|
||||
available. Sites which arhive that newsgroup will also contain copies
|
||||
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:
|
||||
|
||||
Gnu CC
|
||||
@ -150,7 +162,7 @@ is. Here is a partial list of contributors and other individuals.
|
||||
Robert Boucher <boucher@sofkin.ca>
|
||||
Marc Cohen <marc@aai.com>
|
||||
David Cutter <dpc@grail.com>
|
||||
Casper Dik <casper@fwi.uva.nl>
|
||||
Casper Dik <Casper.Dik@Sun.COM>
|
||||
Charles Hedrick <hedrick@geneva.rutgers.edu>
|
||||
Andrew Herbert <andrew@werple.apana.org.au>
|
||||
Jeff Janvrin <jeff.janvrin@columbiasc.ncr.com>
|
||||
@ -173,6 +185,8 @@ AUTHOR
|
||||
|
||||
U.S. Mail address:
|
||||
William LeFebvre
|
||||
170 Colton Crest Drive
|
||||
Alpharetta, GA 30202
|
||||
Group sys Consulting
|
||||
11585 Jones Bridge Road
|
||||
Suite 420-139
|
||||
Alpharetta, GA 30022
|
||||
(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 "sigdesc.h" /* generated automatically */
|
||||
#include "top.h"
|
||||
#include "boolean.h"
|
||||
#include "utils.h"
|
||||
|
||||
@ -153,7 +154,7 @@ int *intp;
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
@ -172,7 +173,7 @@ static char *err_listem =
|
||||
else \
|
||||
{ \
|
||||
errs[errcnt].arg = (p); \
|
||||
errs[errcnt++].errno = (e); \
|
||||
errs[errcnt++].errnum = (e); \
|
||||
}
|
||||
|
||||
/*
|
||||
@ -212,7 +213,7 @@ char *err_string()
|
||||
while (cnt < errcnt)
|
||||
{
|
||||
errp = &(errs[cnt++]);
|
||||
if (errp->errno != currerr)
|
||||
if (errp->errnum != currerr)
|
||||
{
|
||||
if (currerr != -1)
|
||||
{
|
||||
@ -222,7 +223,7 @@ char *err_string()
|
||||
}
|
||||
(void) strcat(string, "; "); /* we know there's more */
|
||||
}
|
||||
currerr = errp->errno;
|
||||
currerr = errp->errnum;
|
||||
first = Yes;
|
||||
}
|
||||
if ((stringlen = str_addarg(string, stringlen, errp->arg, first)) ==0)
|
||||
@ -310,7 +311,7 @@ register struct errs *p1, *p2;
|
||||
{
|
||||
register int result;
|
||||
|
||||
if ((result = p1->errno - p2->errno) == 0)
|
||||
if ((result = p1->errnum - p2->errnum) == 0)
|
||||
{
|
||||
return(strcmp(p1->arg, p2->arg));
|
||||
}
|
||||
@ -341,7 +342,7 @@ show_errors()
|
||||
while (cnt++ < errcnt)
|
||||
{
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -154,9 +154,9 @@ struct statics *statics;
|
||||
ip = cpustate_columns;
|
||||
while (*pp != NULL)
|
||||
{
|
||||
*ip++ = cpustate_total_length;
|
||||
if ((i = strlen(*pp++)) > 0)
|
||||
{
|
||||
*ip++ = cpustate_total_length;
|
||||
cpustate_total_length += i + 8;
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ time_t *tod;
|
||||
}
|
||||
|
||||
static int ltotal = 0;
|
||||
static char procstates_buffer[128];
|
||||
static char procstates_buffer[MAX_COLS];
|
||||
|
||||
/*
|
||||
* *_procstates(total, brkdn, names) - print the process summary line
|
||||
@ -311,7 +311,7 @@ int total;
|
||||
int *brkdn;
|
||||
|
||||
{
|
||||
static char new[128];
|
||||
static char new[MAX_COLS];
|
||||
register int i;
|
||||
|
||||
/* update number of processes only if it has changed */
|
||||
@ -457,7 +457,7 @@ register int *states;
|
||||
((double)value)/10.);
|
||||
|
||||
/* remember it for next time */
|
||||
*lp = *states;
|
||||
*lp = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,86 +1,118 @@
|
||||
#!/bin/csh -f
|
||||
set ny = (no yes)
|
||||
if ($2 == "yesno") then
|
||||
@ i = $3 + 1
|
||||
set pmpt = "$1 [$ny[$i]]: "
|
||||
#!/bin/sh
|
||||
# getans prompt type default results_filename
|
||||
# type is one of
|
||||
# number
|
||||
# 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
|
||||
if ("$3" == "") then
|
||||
set pmpt = "${1}"
|
||||
if [ -z "${DFLT}" ]; then
|
||||
pmpt="${RAWPMPT}"
|
||||
else
|
||||
set pmpt = "$1 [$3]: "
|
||||
endif
|
||||
endif
|
||||
rpt:
|
||||
echo -n "$pmpt"
|
||||
set input = $<
|
||||
switch ($2)
|
||||
case number:
|
||||
set tmp = `echo $input | tr -d 0123456789.`
|
||||
if ("x$tmp" != x) then
|
||||
pmpt="${RAWPMPT} [${DFLT}]: "
|
||||
fi
|
||||
fi
|
||||
if [ x"`echo -n`" = x-n ]
|
||||
then
|
||||
c=\\c
|
||||
else
|
||||
n=-n
|
||||
fi
|
||||
|
||||
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."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
|
||||
case integer:
|
||||
set tmp = `echo $input | tr -d 0123456789`
|
||||
if ("x$tmp" != x) then
|
||||
integer)
|
||||
tmp=`echo $input | tr -d 0123456789`
|
||||
if [ -n "$tmp" ]; then
|
||||
echo "Invalid integer. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
|
||||
case neginteger:
|
||||
if ("x$input" != x-1) then
|
||||
set tmp = `echo $input | tr -d 0123456789`
|
||||
if ("x$tmp" != x) then
|
||||
neginteger)
|
||||
if [ "x$input" != "x-1" ]; then
|
||||
tmp=`echo $input | tr -d 0123456789`
|
||||
if [ -n "$tmp" ]; then
|
||||
echo "Invalid integer. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
endif
|
||||
breaksw
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
case file:
|
||||
if ("x$input" == "x") then
|
||||
set input = $3
|
||||
endif
|
||||
if (! -e "$input") then
|
||||
echo The file $input "does not exist. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
file)
|
||||
if [ -z "$input" ]; then
|
||||
input=${DFLT}
|
||||
fi
|
||||
if [ ! -f "$input" -a ! -d "$input" ]; then
|
||||
echo "The file $input does not exist. Please try again."
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
|
||||
case path:
|
||||
if ("x$input" == "x") then
|
||||
set input = "$3"
|
||||
endif
|
||||
if (! -e "$input") then
|
||||
foreach elt ($path)
|
||||
if (-e "$elt/$input") breaksw
|
||||
end
|
||||
echo The command $input "was not found. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
path)
|
||||
if [ -z "$input" ]; then
|
||||
input="${DFLT}"
|
||||
fi
|
||||
if [ ! -f "$input" ]; then
|
||||
path=`echo $PATH | sed -e s'/::/ . /g' -e 's/:/ /g'`
|
||||
x=
|
||||
for elt in $path; do
|
||||
if [ -f "$elt/$input" ]; then x=1; break; fi
|
||||
done
|
||||
if [ -z "$x" ] ;then
|
||||
echo "The command $input was not found. Please try again."
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
case yesno:
|
||||
if ("x$input" == xy || "x$input" == xyes) then
|
||||
set input = 1
|
||||
else if ("x$input" == xn || "x$input" == xno) then
|
||||
set input = 0
|
||||
else if ("x$input" != x) then
|
||||
echo 'Please answer "yes" or "no".'
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
yesno)
|
||||
if [ -z "$input" ]; then
|
||||
input="${DFLT}"
|
||||
else
|
||||
case $input in
|
||||
y | yes)
|
||||
input=1 ;;
|
||||
n | no)
|
||||
input=0 ;;
|
||||
*)
|
||||
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
|
||||
set input = "$3"
|
||||
endif
|
||||
|
||||
echo $input > $4
|
||||
echo $input > ${OFNM}
|
||||
|
@ -21,12 +21,18 @@ struct statics
|
||||
* 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
|
||||
{
|
||||
int last_pid;
|
||||
double load_avg[NUM_AVERAGES];
|
||||
int p_total;
|
||||
int p_active; /* number of procs considered "active" */
|
||||
int P_ACTIVE; /* number of procs considered "active" */
|
||||
int *procstates;
|
||||
int *cpustates;
|
||||
int *memory;
|
||||
|
@ -27,3 +27,12 @@ caddr_t malloc();
|
||||
# define memzero(a, b) memset((a), 0, (b))
|
||||
typedef void sigret_t;
|
||||
#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].
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
main(argc, argv)
|
||||
|
@ -9,7 +9,7 @@ top \- display and update information about the top cpu processes
|
||||
.SH SYNOPSIS
|
||||
.B top
|
||||
[
|
||||
.B \-SbiInqu
|
||||
.B \-SbiInquv
|
||||
] [
|
||||
.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
|
||||
numbers are displayed instead of the names.
|
||||
.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
|
||||
Show only
|
||||
.I count
|
||||
@ -187,7 +192,8 @@ These commands are currently recognized (^L refers to control-L):
|
||||
.B ^L
|
||||
Redraw the screen.
|
||||
.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
|
||||
.B q
|
||||
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
|
||||
to all users will be displayed.
|
||||
.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
|
||||
Display a list of system errors (if any) generated by the last
|
||||
.BR k ill
|
||||
|
@ -9,7 +9,9 @@ char *copyright =
|
||||
* but this entire comment MUST remain intact.
|
||||
*
|
||||
* 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 */
|
||||
#define Smask(s) (1 << ((s) - 1))
|
||||
|
||||
/* for system errors */
|
||||
extern int errno;
|
||||
|
||||
/* for getopt: */
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
@ -177,7 +176,7 @@ char *argv[];
|
||||
/* FD_SET and friends are not present: fake it */
|
||||
typedef int fd_set;
|
||||
#define FD_ZERO(x) (*(x) = 0)
|
||||
#define FD_SET(f, x) (*(x) = f)
|
||||
#define FD_SET(f, x) (*(x) = 1<<f)
|
||||
#endif
|
||||
fd_set readfds;
|
||||
|
||||
@ -209,6 +208,8 @@ char *argv[];
|
||||
|
||||
/* set the buffer for stdout */
|
||||
#ifdef DEBUG
|
||||
extern FILE *debug;
|
||||
debug = fopen("debug.run", "w");
|
||||
setbuffer(stdout, NULL, 0);
|
||||
#else
|
||||
setbuffer(stdout, stdoutbuf, Buffersize);
|
||||
@ -256,10 +257,16 @@ char *argv[];
|
||||
optind = 1;
|
||||
}
|
||||
|
||||
while ((i = getopt(ac, av, "SIbinqus:d:U:o:")) != EOF)
|
||||
while ((i = getopt(ac, av, "SIbinquvs:d:U:o:")) != EOF)
|
||||
{
|
||||
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 */
|
||||
do_unames = !do_unames;
|
||||
break;
|
||||
@ -304,10 +311,10 @@ char *argv[];
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if ((delay = atoi(optarg)) < 0)
|
||||
if ((delay = atoi(optarg)) < 0 || (delay == 0 && getuid() != 0))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: warning: seconds delay should be non-negative -- using default\n",
|
||||
"%s: warning: seconds delay should be positive -- using default\n",
|
||||
myname);
|
||||
delay = Default_DELAY;
|
||||
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 */
|
||||
/* this number will be the smallest of: active processes,
|
||||
number user requested, number current screen accomodates */
|
||||
active_procs = system_info.p_active;
|
||||
active_procs = system_info.P_ACTIVE;
|
||||
if (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);
|
||||
|
||||
/* 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 */
|
||||
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 */
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(1, &readfds); /* for standard input */
|
||||
FD_SET(0, &readfds); /* for standard input */
|
||||
timeout.tv_sec = delay;
|
||||
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 */
|
||||
/* (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)
|
||||
{
|
||||
/* 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: ");
|
||||
if ((i = readline(tempbuf1, 8, Yes)) > -1)
|
||||
{
|
||||
delay = i;
|
||||
if ((delay = i) == 0 && getuid() != 0)
|
||||
{
|
||||
delay = 1;
|
||||
}
|
||||
}
|
||||
clear_message();
|
||||
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);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
@ -320,27 +320,42 @@ long *diffs;
|
||||
/*
|
||||
* errmsg(errnum) - return an error message string appropriate to the
|
||||
* error number "errnum". This is a substitute for the System V
|
||||
* function "strerror" with one important difference: the string
|
||||
* returned by this function does NOT end in a newline!
|
||||
* N.B.: there appears to be no reliable way to determine if
|
||||
* "strerror" exists at compile time, so I make do by providing
|
||||
* something of similar functionality.
|
||||
* function "strerror". There appears to be no reliable way to
|
||||
* determine if "strerror" exists at compile time, so I make do
|
||||
* by providing something of similar functionality. For those
|
||||
* systems that have strerror and NOT errlist, define
|
||||
* -DHAVE_STRERROR in the module file and this function will
|
||||
* use strerror.
|
||||
*/
|
||||
|
||||
/* externs referenced by errmsg */
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
#ifndef SYS_ERRLIST_DECLARED
|
||||
#define SYS_ERRLIST_DECLARED
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
||||
extern int sys_nerr;
|
||||
#endif
|
||||
|
||||
char *errmsg(errnum)
|
||||
|
||||
int errnum;
|
||||
|
||||
{
|
||||
#ifdef HAVE_STRERROR
|
||||
char *msg = strerror(errnum);
|
||||
if (msg != NULL)
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
#else
|
||||
if (errnum > 0 && errnum < sys_nerr)
|
||||
{
|
||||
return(sys_errlist[errnum]);
|
||||
}
|
||||
#endif
|
||||
return("No error");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user