Add missing cfgetispeed()

Add the missing trivial function from termios(3).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Fix cfset*speed() nonsense

The termios(3) line speed thing is not interesting, but nevertheless,
if we implement cf{set,get}[io]speed() functions, let's at least do it
right.

The current code was a weird, and wrong, combination of archaic Unix and
Linux. In archaic Unix, there was one speed setting for both input and
output, and it was controlled in the c_cflag field of the termios structure,
with the bitmask CBAUD. But Posix allows two separate speeds - input and
output - and doesn't specify where they are kept. Linux/Glibc keeps them in
seperate fields of the termios structure (c_ispeed, c_ospeed), so to be
ABI-compatible with Linux we also have these fields in the structure, and
should use them.

To summarize, our getispeed()/getospeed() functions were correct, reading
the relevant fields of the termios structure, but setispeed()/setospeed(),
apparently copied from musl, were using the old CBAUD technique and didn't
fit what we did in getispeed()/getospeed()! So this patch modifies the set()
functions to match the get() functions. They also now match the glibc
implementation.

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

According to termios(3), cfsetspeed() should set both input and output
speed.

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