cons man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

CONS(9)			 BSD Kernel Developer's Manual		       CONS(9)

NAME
     cnbell, cnflush, cngetc, cngetsn, cnhalt, cnpollc, cnputc — console
     access interface

SYNOPSIS
     #include <dev/cons.h>

     void
     cnbell(u_int pitch, u_int period, u_int volume);

     void
     cnflush(void);

     int
     cngetc(void);

     int
     cngetsn(char *cp, int size);

     void
     cnhalt(void);

     void
     cnpollc(int on);

     void
     cnputc(int c);

DESCRIPTION
     These functions operate over the current console device.  The console
     must be initialized before these functions can be used.

     Console input polling functions cngetc(), cngetsn() and cnpollc() are
     only to be used during initial system boot, e.g., when asking for root
     and dump device or to get necessary user input within mountroothooks.
     Once the system boots, user input is read via standard tty(4) facilities.

     The following is a brief description of each function:

     cnbell()	Ring a bell at appropriate pitch, for duration of period mil‐
		liseconds at given volume.  Note that the volume value is
		ignored commonly.

     cnflush()	Waits for all pending output to finish.

     cngetc()	Poll (busy wait) for an input and return the input key.
		Returns 0 if there is no console input device.	cnpollc() must
		be called before cngetc() could be used.  cngetc() should be
		used during kernel startup only.

     cngetsn()	Read one line of user input, stop reading once the newline key
		is input.  Input is echoed back.  This uses cnpollc() and
		cngetc().  Number of read characters is size at maximum, user
		is notified by console bell when the end of input buffer is
		reached.  <Backspace> key works as expected.  <@> or <CTRL>-u
		make cngetsn() discard input read so far, print newline and
		wait for next input.  cngetsn() returns number of characters
		actually read, excluding the final newline.  cp is not zero-
		ended before return.  cngetsn() should be used during kernel
		startup only.

     cnhalt()	Terminates the console device (i.e. cleanly shuts down the
		console hardware.)

     cnpollc()	Switch the console driver to polling mode if on is nonzero, or
		back to interrupt driven mode if on is zero.  cnpollc() should
		be used during kernel startup only.

     cnputc()	Console kernel output character routine.  Commonly, kernel
		code uses printf(9) rather than using this low-level inter‐
		face.

EXAMPLES
     This waits until a <Enter> key is pressed:

	   int c;

	   cnpollc(1);
	   for(;;) {
		   c = cngetc();
		   if ((c == '\r' || (c == '\n')) {
			   printf("\n");
			   break;
		   }
	   }
	   cnpollc(0);

SEE ALSO
     pckbd(4), pcppi(4), tty(4), wscons(4), wskbd(4), printf(9), spl(9),
     wscons(9)

BSD				 June 8, 2010				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net