Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 1996 08:33:50 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, matt@lkg.dec.com
Cc:        gpalmer@freebsd.org, hackers@freebsd.org
Subject:   Re: PR conf/1270
Message-ID:  <199606022233.IAA09273@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> Each additional statically configured pty currently costs 252 bytes
>> for the tty struct alone, not about 128 bits as guessed in the PR.
>> A default of 32 would still be reasonable.

>That's the problem right there.  The tty structure (and anything else
>required by the pty driver) should be dynanmically allocated on first
>open and closed on last close.  Then keep a list of pointers to softc
>structures inside the pty driver indexed by minor number.  It's even
>releatively make this list dynamic as well so it grows as it needs to.

There is a problem with dangling pointers.  See kern_exit.c:

			/*
			 * s_ttyp is not zero'd; we use this to indicate
			 * that the session once had a controlling terminal.
			 * (for logging and informational purposes)
			 */

and some things follow the pointer for closed devices.  Perhaps only
applications like ptstat -t.  pstat also wants to work with an array of
tty structs.

The same problems interfere with dynamic allocation of tty structs for
hardware ttys, but there is less to be gained by dynamic allocation in
this case.  The closed tty structs are a good place for holding statstics
and the state for the next open (they don't actually hold much of it now).

Bruce



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