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
F153261286: D50832.id.diff
Mon, Apr 20, 3:08 AM
Unknown Object (File)
Thu, Apr 16, 12:16 AM
Unknown Object (File)
Wed, Apr 15, 12:01 PM
Unknown Object (File)
Thu, Apr 9, 7:27 PM
Unknown Object (File)
Mon, Apr 6, 5:32 PM
Unknown Object (File)
Mon, Apr 6, 5:28 PM
Unknown Object (File)
Sun, Apr 5, 3:59 PM
Unknown Object (File)
Sun, Apr 5, 8:33 AM
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 64860
Build 61743: 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.