Page MenuHomeFreeBSD

stand: Add support for `print_delay` environment variable in loader
ClosedPublic

Authored by obiwac on Jun 13 2025, 1:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 18, 9:08 PM
Unknown Object (File)
Tue, Nov 18, 3:14 PM
Unknown Object (File)
Sun, Nov 9, 5:32 PM
Unknown Object (File)
Oct 27 2025, 3:50 PM
Unknown Object (File)
Oct 27 2025, 10:00 AM
Unknown Object (File)
Oct 19 2025, 11:01 PM
Unknown Object (File)
Oct 12 2025, 7:39 PM
Unknown Object (File)
Oct 12 2025, 7:31 PM
Subscribers

Details

Summary

This adds support for a new print_delay environment variable, which inserts a delay (in microseconds, maybe this should be in millis instead?) when putchar encounters a newline character. This can be useful when debugging.

Sponsored by: The FreeBSD Foundation

Test Plan

Just tested in loader.efi, on my machine & in VM.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 64859
Build 61742: arc lint + arc unit

Event Timeline

Let me know if it's not desirable to add new error codes to libsa.

For my taste it's a bit gratuitous--EINVAL should be fine. I'd think that we want to avoid adding new error strings in memory-constrained loader, but Warner has better intuition there.

stand/common/misc.c
216 ↗(On Diff #156965)
222 ↗(On Diff #156965)

Why not have this function in console.c? Then you don't need to export print_delay_usec.

I tend to think the new error values are a bit gratuitous as well... strtonum is approximately what we're doing and it return ERANGE or EINVAL.

stand/common/misc.c
222 ↗(On Diff #156965)

and the print_delay_usec variable...

Move setprint_delay to console.c

Replace ENAN and ENUMNEG errors with existing EINVAL

This revision is now accepted and ready to land.Jun 13 2025, 8:00 PM
markj added inline comments.
stand/common/console.c
47
This revision now requires review to proceed.Jun 14 2025, 1:58 AM
This revision is now accepted and ready to land.Jun 14 2025, 4:25 AM

Rene and John Grafton helped with the doc also in the hacker lounge.

obiwac added reviewers: mckusick, jrm.

Review process is complete with all the right folks signing off.