console: support poll()

poll() on the console was never implemented, and always returned 0
(i.e., no input is available). This patch fixes the various use
cases of poll() on the console.

The easy part is polling for current availability of input. The slightly
harder part is how to blocking until input becomes available. For that,
the line discipline needs to know which "file" structures hold it, to
know what to call "poll_wake" on. Everying is made simpler by changing
the code so that only a single file structure refers to our single console.
We can have several fds pointing to the console (multiple separate opens
of the console, or dup()), but all of them refer to a single file structure.

This patch also includes a new test, tests/tst-console.cc, for
the console, including the current poll() issues. This test works
even with no user input, but can test more fine points if the user
does press some keys while it is working (I used this while developing
the fixes in this patch).

Note that while this patch fixes poll() on fd 0, poll will still not work
on /dev/console because the VFS layer hides the poll implementation.
This is issue #515, and should be fixed separately.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>