return ((*linesw[tp->t_line].l_open)(dev, tp));
s = (*linesw[tp->t_line].l_open)(dev, tp); if (s != 0) { if (tp->t_state & TS_ISOPEN) return (s);  if (tp->t_cflag & HUPCL) { sabtty_mdmctrl(sc, 0, DMSET); (void)tsleep(sc, TTIPRI, ttclos, hz); }  if ((sc->sc_flags & (SABTTYF_CONS_IN | SABTTYF_CONS_OUT)) == 0) {  sabtty_flush(sc); sabtty_reset(sc); } } return (s);
sabttyopen(dev, flags, mode, p)	dev_t dev;	int flags, mode;	struct proc *p;{	struct sab_softc *bc;	struct sabtty_softc *sc;	struct tty *tp;	int card = SAB_CARD(dev), port = SAB_PORT(dev), s;	if (card >= sab_cd.cd_ndevs)		return (ENXIO);	bc = sab_cd.cd_devs[card];	if (bc == NULL)		return (ENXIO);	if (port >= bc->sc_nchild)		return (ENXIO);	sc = bc->sc_child[port];	if (sc == NULL)		return (ENXIO);	tp = sc->sc_tty;	tp->t_dev = dev;	if ((tp->t_state & TS_ISOPEN) == 0) {		tp->t_state |= TS_WOPEN;		ttychars(tp);		tp->t_iflag = TTYDEF_IFLAG;		tp->t_oflag = TTYDEF_OFLAG;		tp->t_cflag = TTYDEF_CFLAG;		if (sc->sc_openflags & TIOCFLAG_CLOCAL)			tp->t_cflag |= CLOCAL;		if (sc->sc_openflags & TIOCFLAG_CRTSCTS)			tp->t_cflag |= CRTSCTS;		if (sc->sc_openflags & TIOCFLAG_MDMBUF)			tp->t_cflag |= MDMBUF;		tp->t_lflag = TTYDEF_LFLAG;		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;		sc->sc_rput = sc->sc_rget = sc->sc_rbuf;		s = spltty();		sabtty_reset(sc);		sabtty_param(tp, &tp->t_termios);		ttsetwater(tp);		sc->sc_imr0 = SAB_IMR0_PERR | SAB_IMR0_FERR | SAB_IMR0_PLLA;		SAB_WRITE(sc, SAB_IMR0, sc->sc_imr0);		sc->sc_imr1 = SAB_IMR1_BRKT | SAB_IMR1_ALLS | SAB_IMR1_XDU |		    SAB_IMR1_TIN | SAB_IMR1_CSC | SAB_IMR1_XMR | SAB_IMR1_XPR;		SAB_WRITE(sc, SAB_IMR1, sc->sc_imr1);		SAB_WRITE(sc, SAB_CCR0, SAB_READ(sc, SAB_CCR0) | SAB_CCR0_PU);		sabtty_flush(sc);		if ((sc->sc_openflags & TIOCFLAG_SOFTCAR) ||		    (SAB_READ(sc, SAB_VSTR) & SAB_VSTR_CD))			tp->t_state |= TS_CARR_ON;		else			tp->t_state &= ~TS_CARR_ON;	} else if ((tp->t_state & TS_XCLUDE) &&	    (!suser(p->p_ucred, &p->p_acflag))) {		return (EBUSY);	} else {		s = spltty();	}	if ((flags & O_NONBLOCK) == 0) {		while ((tp->t_cflag & CLOCAL) == 0 &&		    (tp->t_state & TS_CARR_ON) == 0) {			int error;			tp->t_state |= TS_WOPEN;			error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,			    "sabttycd", 0);			if (error != 0) {				splx(s);				tp->t_state &= ~TS_WOPEN;				return (error);			}		}	}	splx(s);	return ((*linesw[tp->t_line].l_open)(dev, tp));}