From owner-freebsd-hackers Sun Jun 2 15:36:57 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA14622 for hackers-outgoing; Sun, 2 Jun 1996 15:36:57 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id PAA14617; Sun, 2 Jun 1996 15:36:53 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id IAA09273; Mon, 3 Jun 1996 08:33:50 +1000 Date: Mon, 3 Jun 1996 08:33:50 +1000 From: Bruce Evans Message-Id: <199606022233.IAA09273@godzilla.zeta.org.au> To: bde@zeta.org.au, matt@lkg.dec.com Subject: Re: PR conf/1270 Cc: gpalmer@freebsd.org, hackers@freebsd.org Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >> 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