Page MenuHomeFreeBSD

top: add -p option and p command to only show a single process
ClosedPublic

Authored by novel on May 20 2018, 2:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 26, 3:45 PM
Unknown Object (File)
Oct 20 2024, 3:50 PM
Unknown Object (File)
Oct 3 2024, 3:07 PM
Unknown Object (File)
Sep 27 2024, 1:11 AM
Unknown Object (File)
Sep 24 2024, 5:24 AM
Unknown Object (File)
Sep 23 2024, 3:04 AM
Unknown Object (File)
Sep 19 2024, 4:38 AM
Unknown Object (File)
Sep 6 2024, 6:51 PM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 16804

Event Timeline

novel retitled this revision from top: add -pp option and p command to only show a single process to top: add -p option and p command to only show a single process.May 20 2018, 2:56 PM
top/top.c
1229–1230

Personally, I like declaring variables close to the use, but its atypical in freebsd code. Lets see if we could sneak it in. :-p

top/top.xs
20 ↗(On Diff #42768)

this should now just be a .1 file. Same change though

top/utils.c
480

Can we use a named constant for 23? Also are we sure we want to quit and not generate an error message?

also, I prefer braces even for single line ifs.

485

ditto to above

492

ditto: lets use a named constant?

  • Use constant for exit code 23,
  • Move manpage changes from top.xs to top.1,
  • Proper error handling in find_pid().
novel added inline comments.
top/utils.c
480

Done. 23 is also used in other places, so updated those as well. Also added an error message.

485

I re-wrote this chunk a bit. As we request specific pid from kvm_getprocs(), it's normal if it returns NULL, should not exit in this case and let the caller of find_pid() handle the invalid pid.

I've also updated kvm_open() call to set errstr to NULL as we generate our own messages for when pid was not found.

Also, I noticed as I leak kvm_t because not calling kvm_close(), should be fixed now as well.

492

That's actually a debug leftover, removed.

This revision is now accepted and ready to land.May 24 2018, 5:59 AM
This revision was automatically updated to reflect the committed changes.