Page MenuHomeFreeBSD

bhyve: Eliminate exit status magic numbers
ClosedPublic

Authored by bnovkov on Nov 13 2025, 11:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 24, 5:50 AM
Unknown Object (File)
Thu, Dec 11, 6:56 PM
Unknown Object (File)
Dec 9 2025, 8:11 AM
Unknown Object (File)
Dec 4 2025, 6:25 AM
Unknown Object (File)
Dec 3 2025, 6:07 AM
Unknown Object (File)
Nov 28 2025, 10:33 AM
Unknown Object (File)
Nov 28 2025, 1:11 AM
Unknown Object (File)
Nov 27 2025, 7:50 AM

Details

Summary

bhyve's exit status codes indicate how the VM was terminated.
Unfortunately, their meaning within the source code is somewhat
unclear since they are only used as magic numbers.

Fix this by defining exit status macros and using them to replace
the magic numbers in exit(3) function calls.

Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This revision is now accepted and ready to land.Nov 13 2025, 3:46 PM
usr.sbin/bhyve/bhyverun.h
37

Maybe comments here and in bhyve.8 mentioning that this list also exists in the other one?

This revision now requires review to proceed.Nov 17 2025, 2:54 PM
bnovkov added inline comments.
usr.sbin/bhyve/bhyverun.h
37

Thanks for the suggestion, I've added a reference to the manpage here.
I don't think it makes sense to reference the bhyverun.h list in the manpage.

I don't think it makes sense to reference the bhyverun.h list in the manpage.

Yes fair point, nobody is going to start with the man page to add new exit codes.

This revision is now accepted and ready to land.Nov 17 2025, 3:06 PM
This revision was automatically updated to reflect the committed changes.
bnovkov marked an inline comment as done.