Subject: Re: should cngetc block?
To: None <,>
From: None <>
List: tech-kern
Date: 02/05/2002 23:47:38
| Jaromir Dolecek <> writes:
| > wrote:
| > > I'm looking for a function like cngetc (in dev/cons.c), but
| > > doesn't block for an available char.
| > 
| > Note that cngetc() is only mean for very limited set of things,
| > where it's not possible to use the terminal interface, like
| > when asking for root/swap on boot, or when in DDB.
| Exactly.  We have a boot monitor/loader built from a barebone
| kernel.
| I'm looking for a function to poll (but not block) for keyboard
| input.  It seems to me cngetc should not block (unless enabled by
| cnpollc(1)), and if so would be the right function for me.

cnpollc() is there to enable or disable interrupts so the console
device can enter and exit polled I/O mode, not to change the 
behavior of cngetc().  (Arguably, the code currently in the
com driver to check for break sequences while doing console output
is broken if we follow the current interface definition.)

Changing that interface will require modifications to all drivers
that support that console interface, not just the `com' driver.
If you want to change that interface so that cngetc() does not
block, you need to put together a proposal explaining what you
want to do, how you want to do it, and why it's needed.