ssize_t write_chan (struct tty_struct * tty, struct file * file, const unsigned char * buf, size_t nr);
Write function of the terminal device. This is serialized with respect to other write callers but not to termios changes, reads and other such events. We must be careful with N_TTY as the receive code will echo characters, thus calling driver write methods.
This code must be sure never to sleep through a hangup.