Subject: Re: pcvt and TIOCCONS
To: Chris G Demetriou <Chris_G_Demetriou@UX2.SP.CS.CMU.EDU>
From: David Brownlee <>
List: current-users
Date: 04/22/1996 11:35:27
On Sun, 21 Apr 1996, Chris G Demetriou wrote:

> If you combine /etc/ttys and the 'fbtab-ish' file, then you make
> information in the latter harder to find; it's drowned out by all of
> the entries in /etc/ttys which _must_ be there for all ttys for which
> logins should be allowed.


	It seems stupid to have /etc/ttys list all the ptys with just 
	default behaviour. I know damn well how many ptys are available
	as I configured the kernel...  This is a real pain when you add
	more ptys into the kernel but forget /etc/ttys and then wonder
	why the 32nd pty onwards doesnt get listed in utmp or wtmp.

	To remove the need for default entries for ptys in /etc/ttys,
	we would need ttyslot() and gettyent() modified and a new sysctl
	to get the number of ptys (useful thing to have anyway)

	Actually a single 'default' line for all unlisted ptys would be
	a nice win...

	We should probably define somehere the correct way to cycle through
	the available ptys (and have a library call that telnetd & friends
	can use rather than them all having their own
		"for (cp = "pqrstuvwxyzPQRST"; *cp; cp++) {
                 *p2 = "0123456789abcdef"[i];"
	type code - but thats another issue).

	Assuming that /etc/ttys only has hardwired terminals by default:

	The obvious things that are going to hit /etc/ttys

	    ttyflags - no problem.
	    ttyslot - this is the problem one, I assume login will use
	    ttyslot to work out what entry in utmp to use. Need to change
	    ttyslot to start at 0 & increment for any hardwired terminal
	    it finds (must let people put ptys in there if they insist).
	    If the terminal being asked for is hardwired then it will be
	    found in that search, so just return the value. If its a pty
	    then you now know the slot for last hardwired terminal.
	    Given the ptys name you can determine what offset to add to
	    that slot.
	    Could map the slots with all possible ptys first, then add
	    hardwired slots on the end - easier conceptually, but less
	    optimal for programs reading utmp when users on hardwired ttys.
	    anything else that uses getty{nam,ent} - time to check the
	    source tree I think, init springs to mind. We really need
	    to keep the current functionality of getttyent() cycling
	    through all possible terminals.

	    Make gettyent() and gettynam() use sysctl to work out if a
	    terminal is valid - they will just 'fake' a default entry
	    if the pty is valid & not listed in /etc/ttys.


                   David/abs             (

  System Manager, Southern Studios, Box 59, London N22 1AR. +44 181 888 8949 
  Monochrome - telnet - un*x for pc,sun,mac,
  **Largest UK Internet BBS!**  dec,atari,amiga+more