| Summary: | /usr/bin/top uses 100% cpu in 'system' | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Avleen Vig <lists-sendpr> |
| Component: | bin | Assignee: | dwmalone |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | lists-sendpr |
| Priority: | Normal | ||
| Version: | 4.4-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Avleen Vig
2002-05-03 10:40:01 UTC
On Fri, May 03, 2002 at 09:33:13AM -0000, Avleen Vig wrote: > >How-To-Repeat: > Run: 'top -s -o size'. I don't recommend doing this on a heavily > loaded box straight away. Try it on your desktop. You can still > quit top easily with the 'q' key. > > >Fix: > Unknown Problem is that the handling of arguments is a little bit broken. For 4.5, the patch would be: --- /usr/src/contrib/top/top.c.old Fri May 3 22:38:48 2002 +++ /usr/src/contrib/top/top.c Fri May 3 22:39:14 2002 @@ -317,10 +317,10 @@ break; case 's': - if ((delay = atoi(optarg)) < 0) + if ((delay = atoi(optarg)) <= 0) { fprintf(stderr, - "%s: warning: seconds delay should be non-negative -- using default\n", + "%s: warning: seconds delay should be postive -- using default\n", myname); delay = Default_DELAY; warnings++; With this information a similair patch for -current would be easy to make. The handling of the fact that the integer value of "size" is translated into 0 and is displaying zero lines of process-output is not tackled by this, since people might want to display zero processes and have only the summary. Edwin -- Edwin Groothuis | Personal website: http://www.MavEtJu.org edwin@mavetju.org | Interested in MUDs? Visit Fatal Dimensions: bash$ :(){ :|:&};: | http://www.FatalDimensions.org/ On Sat, 4 May 2002, David Malone wrote: > On Fri, May 03, 2002 at 05:50:07AM -0700, Edwin Groothuis wrote: > > case 's': > > - if ((delay = atoi(optarg)) < 0) > > + if ((delay = atoi(optarg)) <= 0) > > { > > I think this has been fixed in -current in another way: > > if ((delay = atoi(optarg)) < 0 || (delay == 0 && getuid() != 0)) > > this means you're only alowd to get continious updates if you're > root. (This change came from the last beta version of top which > was released by the original authors.) -current still has the bad options parsing, and a delay of 0 causes strange synchronization at least on syscons consoles: the user/nice/system/interrupt/idle percentages are usually all displayed as "0.0". Bruce Responsible Changed From-To: freebsd-bugs->dwmalone Top PR for me. State Changed From-To: open->closed This problem is fixed for regular users with the version of top I just MFCed. It still allows root to run "top -s 0", which produces weird output, but that might be useful for some. |