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
F141987087: D50832.id157015.diff
Wed, Jan 14, 1:12 PM
F141984613: D50832.id157005.diff
Wed, Jan 14, 12:35 PM
F141983763: D50832.id158867.diff
Wed, Jan 14, 12:24 PM
F141983503: D50832.id157014.diff
Wed, Jan 14, 12:20 PM
F141944983: D50832.id157005.diff
Tue, Jan 13, 11:15 PM
Unknown Object (File)
Sat, Jan 3, 3:37 PM
Unknown Object (File)
Mon, Dec 29, 1:21 PM
Unknown Object (File)
Dec 14 2025, 6: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 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.