static int
ethercons_tty_open(dev_t dev, int flags, int mode, struct thread *td)
{
        struct tty *tp;
        int error;

        tp = dev->si_tty;
        KASSERT(tp == ethercons_tty, ("tp != ethercons_tty"));

        if (tp->t_state & TS_ISOPEN) {
                if (tp->t_state & TS_XCLUDE) {
                        error = suser(td);
                        if (error)
#ifdef MAYBE
                                return (error);
#else /* BUT_SOMETIMES */
                                return (EBUSY);
#endif
                }
        } else {
#ifdef MAYBE_UP_HERE
                ttychars(tp);
#endif
#ifdef USUALLY_PRESENT_BUT_ALSO_DONE_BY_TTYOPEN
                tp->t_dev = dev;
#endif
                tp->t_cflag = TTYDEF_CFLAG;
                tp->t_iflag = TTYDEF_IFLAG;
                tp->t_lflag = TTYDEF_LFLAG;
                tp->t_oflag = TTYDEF_OFLAG;
                tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
#ifdef MAYBE_SOMETIMES_DOWN_HERE
                ttychars(tp);
#endif
#ifdef UNLIKELY_AS_ALSO_DONE_BY_TTYOPEN
                ttsetwater(tp);
#endif
        }
#ifdef MAYBE_HERE_OR_MAYBE_BY_TTYCHARS
        (*linesw[tp->t_line].l_modem(tp, 1);
#endif
#ifdef FREQUENTLY
        error = ttyopen(dev, tp);
        if (error)
                return (error);
#endif
        error = (*linesw[tp->t_line].l_open)(dev, tp);
        return (error);
}

