add_wait_queue(&pty->open_wait, &wait);
#ifndef NO_ANK_FIX
current->state = TASK_INTERRUPTIBLE;
#endif
retval = 0;
while (1) {
if (current->signal & ~current->blocked) {
retval = -ERESTARTSYS;
break;
}
/*
* Block until the master is open...
*/
if (tty->link->count &&
!test_bit(TTY_OTHER_CLOSED, &tty->flags))
break;
schedule();
}
current->state = TASK_RUNNING;
remove_wait_queue(&pty->open_wait, &wait);
I'd like to repeat my question.
Are you sure, that it should wait for master open?
All the applications, that I've seen (rlogind, telnetd, emacs, xterm),
open master and only then open slave.
I'd propose return EIO (EAGAIN,....) on the attempt to
open orphaned pty slave. If BSD does not make it, it is
BSD's bug, I believe.
Alexey Kuznetsov.