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)
Fri, Oct 3, 7:13 AM
Unknown Object (File)
Thu, Oct 2, 11:53 PM
Unknown Object (File)
Thu, Oct 2, 11:07 AM
Unknown Object (File)
Thu, Oct 2, 8:54 AM
Unknown Object (File)
Thu, Oct 2, 2:08 AM
Unknown Object (File)
Wed, Oct 1, 6:35 AM
Unknown Object (File)
Sat, Sep 27, 10:46 PM
Unknown Object (File)
Wed, Sep 17, 11:05 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 64858
Build 61741: 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.