Port-sparc64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Custom boot loader stub
On Fri, Oct 24, 2025 at 17:49:30 +0100, Sad Clouds wrote:
> On Fri, 24 Oct 2025 14:30:17 +0300 Valery Ushakov <uwe%stderr.spb.ru@localhost> wrote:
>
> > From a quick look I'd venture a guess that you might want to use
> > poll-tty first, before calling read to read the data that you now know
> > is there.
>
> Thanks for the pointers. I've just realised the solution was right
> there in front of me in Illumos prom_getchar(). My brain didn't quite
> register that it was polling for input in a while loop.
>
> This is what I should have done:
>
> char ofw_read_stdin_char(void)
> {
> int64_t i64;
> char c;
>
> do
> {
> /* Continually returns -2 while no data is ready on stdin */
> i64 = ofw_read_stdin(&c, 1);
> } while (i64 == -2);
poll-tty seems nicer, as it handles e.g. abort on break.
-uwe
Home |
Main Index |
Thread Index |
Old Index