Size bug in top(1)
Barry Shein
bzs at bu-cs.UUCP
Sat Jul 5 12:27:13 AEST 1986
>In top(1), where it prints out the size of the job and the resident
>size of the job, it assumes that clicks are 512 bytes. It does a
>right shift by 1 to convert to K and then prints out the numbers. The
>correct thing to do is to use the macro ctob() which is defined in
>param.h. I don't have the context diff for this but it should be easy
>to find. This only effects non-vax machines probably.
>
>Perry
Thanks for pointing this out, you're right, it's wrong, I think
the following fixes it: (slightly different than your suggestion)
-------------begin fix----------
/*
* BZS at BU-CS.BU.EDU 7/4/86
* - fix suggested in net.sources.bugs, mostly for SUN
(pp->p_tsize + pp->p_dsize + pp->p_ssize) >> 1,
pp->p_rssize >> 1,
*/
#if PGSHIFT > 10
(pp->p_tsize + pp->p_dsize + pp->p_ssize) << (PGSHIFT-10),
pp->p_rssize << (PGSHIFT-10),
#else
(pp->p_tsize + pp->p_dsize + pp->p_ssize) >> (10-PGSHIFT),
pp->p_rssize >> (10-PGSHIFT),
#endif
------------end fix---------------
Note that the #if is necessitated by the fact that you can't
use a negative shift quantity on the SUN. I tried the above
fixed version on a VAX and it seemed fine. This should be as
portable as something like the above can be.
-Barry Shein, Boston University
More information about the Comp.sources.bugs
mailing list