Preliminary termios support

This is some initial work on support real PTYs.
Canonical mode is not supported at the moment.