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)
Thu, Mar 7, 11:48 PM
Unknown Object (File)
Feb 10 2024, 8:25 PM
Unknown Object (File)
Jan 15 2024, 3:25 AM
Unknown Object (File)
Dec 17 2023, 8:13 PM
Unknown Object (File)
Nov 7 2023, 2:01 PM
Unknown Object (File)
Nov 4 2023, 5:36 AM
Unknown Object (File)
Nov 4 2023, 5:05 AM
Unknown Object (File)
Oct 29 2023, 12:22 PM
Subscribers

Diff Detail

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

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

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.