This is largely based on OpenBSD commit https://github.com/openbsd/src/commit/4211733af71e7d895025a9fc9273eed046e77106
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 16803
Event Timeline
top/top.c | ||
---|---|---|
1229–1230 ↗ | (On Diff #42768) | 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 ↗ | (On Diff #42768) | 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 ↗ | (On Diff #42768) | ditto to above |
492 ↗ | (On Diff #42768) | 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().
top/utils.c | ||
---|---|---|
480 ↗ | (On Diff #42768) | Done. 23 is also used in other places, so updated those as well. Also added an error message. |
485 ↗ | (On Diff #42768) | 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 ↗ | (On Diff #42768) | That's actually a debug leftover, removed. |