Preserve baud rates in termios table
Preserve baud rates in termios table

Previous versions of the termios interface assumed that the baud rate
constants B0 B50 ... B115200 were bit masks that needed to be set in the
cflags member of the termios struct. On most modern operating systems
those are actually mapped to different members (not usually documented)
that contain the baud speed. This speed is set using the posix
functions: cfgetispeed(), cfgetospeed(), cfsetispeed(), and
cfsetospeed(). Because the termios_p struct is translated into a lua
table rather than being maintained in its original data format, extra
information like the baud rate is lost.  This doesn't effect
manipulations on ptty devices, but attempting to use this functionality
over a physical serial connection results in the baud rate being set to
whatever value was in the termios_p when it was created.

This patch fixes this issue by adding the ispeed and ospeed to the lua
representation of termios_p. This will allow luaposix to properly handle
serial files backed by physical pipes.

rrthomas/luaposix,luaposix/luaposix,jimmyharris/luaposix,rrthomas/luaposix,jimmyharris/luaposix