Page MenuHomeFreeBSD

Changed to eliminate the upper limit of command length displayed by "-a" and expand to match terminal width
ClosedPublic

Authored by daichi on Jul 1 2018, 5:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 10 2024, 12:17 PM
Unknown Object (File)
Jan 3 2024, 3:47 PM
Unknown Object (File)
Dec 25 2023, 5:02 AM
Unknown Object (File)
Dec 22 2023, 9:18 PM
Unknown Object (File)
Nov 30 2023, 2:54 AM
Unknown Object (File)
Nov 30 2023, 12:18 AM
Unknown Object (File)
Nov 24 2023, 1:42 PM
Unknown Object (File)
Nov 17 2023, 8:11 PM
Subscribers

Details

Reviewers
eadler
gnn
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rS336028: Changed to eliminate the upper limit of command length displayed
Summary

Changed to eliminate the upper limit of command length displayed by "-a" and expand to match terminal width

Test Plan

on A terminal:

% touch 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
% cat - 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

on B terminal:

% top -a -d 1

result:

original top:
% top -a -d 1 | grep cat
  879 daichi        1  20    0   11M    3M piperd   1   0:00   0.00% grep cat
  852 daichi        1  20    0   11M    2M ttyin    1   0:00   0.00% [cat]
%

patched top (terminal width is 80):
% top -a -d 1 | grep cat
 9835 daichi        1  20    0   11M    3M piperd   0   0:00   0.00% grep cat
 9830 daichi        1  20    0   11M    2M ttyin    1   0:00   0.00% cat - 0123
%

patched top (terminal width is 512):
% top -a -d 1 | grep cat
 9860 daichi        1  20    0   11M    3M piperd   0   0:00   0.00% grep cat
 9830 daichi        1  20    0   11M    2M ttyin    1   0:00   0.00% cat - 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 01234567890123456789012345678901
%

patched top (terminal width is 1128):
% top -a -d 1 | grep cat
 9862 daichi        1  20    0   11M    3M piperd   1   0:00   0.00% grep cat
 9830 daichi        1  20    0   11M    2M ttyin    1   0:00   0.00% cat - 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 012345678901234567890123456789012345678901
%

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

usr.bin/top/machine.c
874 ↗(On Diff #44710)

Where does screen_width come from?

I'd like to move away from using static sizes and limits. This is fine as a stop-gap, but please consider changes that remove such static sizes.

daichi retitled this revision from increased the maximum length of command shown by "-a" to 1024 to Changed to eliminate the upper limit of command length displayed by "-a" and expand to match terminal width.
daichi edited the summary of this revision. (Show Details)
daichi edited the test plan for this revision. (Show Details)

Follow Eadler's advice and abolish static value. However, it is still in the early stage. More testing is necessary. Please test it.

eadler requested changes to this revision.Jul 5 2018, 2:03 AM
eadler added inline comments.
usr.bin/top/display.c
333 ↗(On Diff #44882)

can this be a function instead of a macro?

336 ↗(On Diff #44882)

Why do the multiplication, and then use ,1? when using calloc? Use the args as intended :)

342 ↗(On Diff #44882)

ditto

usr.bin/top/machine.c
873 ↗(On Diff #44882)

remove cmdlen and just use screen_width directly.

This revision now requires changes to proceed.Jul 5 2018, 2:03 AM

It corresponded to Eitan's advice.

Approved by mentor.

I'll probably spend some time to sbufize this, but this change is good for now.

This revision is now accepted and ready to land.Jul 6 2018, 10:41 AM
This revision was automatically updated to reflect the committed changes.
Owners added a reviewer: Restricted Owners Package.Jul 6 2018, 12:07 PM