From owner-freebsd-current Tue Jul 3 23:18:53 2001 Delivered-To: freebsd-current@freebsd.org Received: from nasu.utsunomiya-u.ac.jp (nasu.utsunomiya-u.ac.jp [160.12.128.3]) by hub.freebsd.org (Postfix) with ESMTP id E89DC37B405; Tue, 3 Jul 2001 23:18:41 -0700 (PDT) (envelope-from yokota@zodiac.mech.utsunomiya-u.ac.jp) Received: from nantai.utsunomiya-u.ac.jp by nasu.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/26Jan01-1134AM) id f646IXB28515; Wed, 4 Jul 2001 15:18:33 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp by nantai.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/30Jan01-0241PM) id f646IXI44715; Wed, 4 Jul 2001 15:18:33 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:HpMVma2xk+6FV6y+Mut8DEGg1HbYIeOh@zodiac.mech.utsunomiya-u.ac.jp [160.12.43.7]) by zodiac.mech.utsunomiya-u.ac.jp (8.9.3+3.2W/3.7W/zodiac-May2000) with ESMTP id PAA07548; Wed, 4 Jul 2001 15:28:04 +0900 (JST) Message-Id: <200107040628.PAA07548@zodiac.mech.utsunomiya-u.ac.jp> To: Ruslan Ermilov , Bruce Evans , Alfred Perlstein , current@freebsd.org Cc: yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: tangled dev_t, struct tty and screen in syscons (was: Re: TIOCSCTTY) Date: Wed, 04 Jul 2001 15:28:03 +0900 From: Kazutaka YOKOTA Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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