Page MenuHomeFreeBSD

Use kern.bootfile in pmcstat(8) rather than hardcoding /boot/kernel.
ClosedPublic

Authored by jhb on May 1 2015, 6:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 2:24 PM
Unknown Object (File)
Mar 10 2024, 3:56 PM
Unknown Object (File)
Dec 11 2023, 5:34 PM
Unknown Object (File)
Nov 27 2023, 10:00 PM
Unknown Object (File)
Nov 6 2023, 5:15 AM
Unknown Object (File)
Nov 5 2023, 7:46 PM
Unknown Object (File)
Oct 26 2023, 9:00 PM
Unknown Object (File)
Oct 5 2023, 3:59 AM
Subscribers

Details

Summary

Use the kern.bootfile sysctl to set the default kernel path rather
than hardcoding /boot/kernel. This allows pmcstat(8) to work without
-k when using nextboot -k or 'boot foo' at the loader to boot alternate
kernels.

Test Plan
  • Boot a kernel not named /boot/kernel/kernel and verify pmcstat without -k outputs sensible symbols instead of bizarre ones.

Diff Detail

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

Event Timeline

jhb retitled this revision from to Use kern.bootfile in pmcstat(8) rather than hardcoding /boot/kernel..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added reviewers: adrian, emaste, gnn.
adrian edited edge metadata.
This revision is now accepted and ready to land.May 1 2015, 6:11 PM
gnn edited edge metadata.
usr.sbin/pmcstat/pmcstat.c
615 ↗(On Diff #5143)

Minor point, should k still work even if kern.bootfile fails?

usr.sbin/pmcstat/pmcstat.c
615 ↗(On Diff #5143)

I almost did that but decided against it. I don't think kern.bootfile can ever fail as it is always present. It can only fail if malloc() returns NULL perhaps (which I should check for).

However, I do think there is the question of if the default should be kern.bootfile or /boot/kernel if -r is specified. I suspect it is probably just simpler to have it always be kern.bootfile though than to try to have it be too smart.

emaste edited edge metadata.
This revision was automatically updated to reflect the committed changes.