test and set the state of current events that are pending on a console


#include <sys/console.h>
unsigned console_state( struct _console_ctrl *cc,
                        int console,
                        unsigned bits,
                        unsigned mask );


The console_state() function is used to test and set (or clear) the state of the current events that are pending on the console device indicated by console.

The argument cc is a pointer to a control structure that was returned by a previous call to console_open(). The argument console has a value of 1 to represent the device named /dev/con1, a value of 2 for /dev/con2, and so on. A value of 0 for console indicates the default console (that is, the one used by console_open()). A value of -1 for console indicates the currently visible console.

Any event bits that are set in mask are set to the corresponding bit in bits. The value of the event state before this operation is applied is returned.

Events are defined in <sys/console.h>, and include events such as:

Output has changed on this console.
The console has changed size.
The console is no longer visible.
The console is now visible.


The console_state() function returns the current state of the console indicated by console. If an error occurs, -1 is returned, and errno is set.


The control structure is in the wrong format.
The console value is invalid.


See console_arm().



Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

console_active(), console_arm(), console_close(), console_ctrl(), console_font(), console_info(), console_open(), console_protocol(), console_read(), console_size(), console_write(), errno