Implement openpty, forkpty and login_tty