Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Jul 2001 15:28:03 +0900
From:      Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To:        Ruslan Ermilov <ru@freebsd.org>, Bruce Evans <bde@zeta.org.au>, Alfred Perlstein <bright@sneakerz.org>, current@freebsd.org
Cc:        yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject:   tangled dev_t, struct tty and screen in syscons (was: Re: TIOCSCTTY)
Message-ID:  <200107040628.PAA07548@zodiac.mech.utsunomiya-u.ac.jp>

next in thread | raw e-mail | index | archive | help
JFYI, 

In i386, /dev/console is the same as /dev/consolectl, and all I/O
operations for /dev/console, /dev/concolectl and /dev/ttyv0 take place
in the screen #0, as shown below.  In alpha /dev/console is /dev/ttyv0.
Access to /dev/console is routed to /dev/consolectl's dev_t by
cdevsw functions in kern/tty_cons.c.  

When syscons is not acting as the system/kernel console, /dev/console
is not connected to /dev/console or /dev/ttyv0. But /dev/consolectl
still exists.

  /dev/console     /dev/consolectl    /dev/ttyv0    /dev/ttyvN
      |                  |                |             |
      V                  |                |             |
    dev_t                |                |             |
      |                  V                V             V
      +--------------->dev_t            dev_t         dev_t
                         |                |             |
                         V                V             V
                    struct tty       struct tty    struct tty
                         |                |             |
                         +--------------->|             |
                                          |             |
                                          V             V
                                      screen #0     screen #N


As /dev/consolectl doesn't need to get input from or put output to the
screen, it can exist without an associated screen. In that sense, it
perhaps doesn't even need a struct tty.  Maybe we also should give
/dev/console a separate a screen than ttyv0.  See the figure below.

But, even in this configuration, we still have two copies of dev_t for
/dev/console: the native dev_t (*1) and the underlaying dev_t (*2).
As make_dev(9) requires us to supply the name to create a dev_t, dev_t
(*2) will appear under /dev and will be accessible from the user land,
thus, we still have "the last close()" problem, I guess.

  /dev/console     /dev/consolectl    /dev/ttyv0    /dev/ttyvN
      |                    |              |             |
      V                    |              |             |
    dev_t                  |              |             |
      | *1                 |              |             |
      +-------+            |              |             |
              |            |              |             |
              V            V              V             V
            dev_t        dev_t          dev_t         dev_t
              | *2         |              |             |
              V            V              V             V
         struct tty   (struct tty)   struct tty    struct tty
              |                           |             |
              +-------????--------------->|             |
              |                           |             |
             ???                          |             |
              |                           |             |
              V                           V             V
          screen #X                   screen #0     screen #N


Kazu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107040628.PAA07548>