[comp.sys.sun] How to increase number of pseudo terminals

gls@gatech.edu (Gary Schaps) (03/24/89)

markb@ea.ucla.edu (sundance) writes:
> On my Sun4/280 with SunOS 4.0, we have numerous remote logins.  We run out
> of pseudo tty's ...

I increased the number of pseudo tty's supported on our Sun 3/280 under OS
3.5 (about a year ago) by obtaining a modified version of tty_pty.o from
Sun.  At the time, I was told that 64 is _the_ limit.

Gary L. Schaps			
P.O. Box 4393		   e-mail: gls@novavax.UUCP	
Miami Lakes, FL  33014		...{gatech!uflorida,sun!sunvice}!novavax!gls

guy@uunet.uu.net (Guy Harris) (03/30/89)

>On my Sun4/280 with SunOS 4.0, we have numerous remote logins.  We run out
>of pseudo tty's and receive the following error:
>
>    ldtermopen: open fails, can't allocate state structure

As William LeFebvre indicated, you have to crank up the number of 128-byte
streams dblocks, since "ldterm" (the "standard tty line discipline"
streams module) snarfs a 128-byte streams dblock to hold its internal
state when an instance of it is pushed onto a tty stream.

>I looked all over the place in param.c and elsewhere for something that
>would be in charge of pseudo tty's.  I even grepped for 40 to find it that
>way.

By default, the system is, as I remember, configured for 48 pseudo-ttys.
If you need more, in addition to increasing the number of stream heads
(which will, I expect, be dynamically allocated in 4.1, so you won't have
to configure it there) and 128-byte dblocks, you will also have to
increase the number of pseudo-ttys.

There *is* a config-file line that controls the number of pseudo-ttys
supported, and increasing it should work under 4.0 (it didn't work under
previous releases, since the number was compiled into "tty_pty.c"; 4.0 has
a "tty_ptyconf.c").  The line is

	pseudo-device	pty		# pseudo-tty's, also needed for SunView

which defaults to 48 pseudo-ttys, as I remember.  If you want 64, try

	pseudo-device	pty64

Note that, since programs search for an "unused" pseudo-tty by trying
"/dev/ptyp0" to see if it's in use, and then cycling up to "/dev/ptysf",
they will generally only check the first 64 possible pseudo-ttys, so even
if you do boost the number above 64 "rlogind", "telnetd", "script",
"shelltool", etc. may not see any past the first 64.  (This problem is,
most likely, common to most systems with BSD-derived pseudo-tty code and
BSD-derived network servers.  I expect the S5R4 pseudo-tty mechanism not
to require you to manually search for an unused pseudo-tty; after all, the
driver knows which ones are free, and if the driver supports a "clone
open" it will pick a free one for you.  This should mean programs won't
have to "know" how many pseudo-ttys to search through.)

guy@uunet.uu.net (Guy Harris) (04/07/89)

>I increased the number of pseudo tty's supported on our Sun 3/280 under OS
>3.5 (about a year ago) by obtaining a modified version of tty_pty.o from
>Sun.  At the time, I was told that 64 is _the_ limit.

The use of "the" in "_the_ limit" is incorrect.  There are at least two
limits:

	1) The limit on the number of pseudo-ttys that the pseudo-tty
	   driver will support.  Prior to 4.0, that limit was compiled
	   into the pseudo-tty driver (tty_pty.o), and was 48 in the
	   distributed version.  In 4.0, it's configurable without
	   source, and can go up to 256, I think (since the minor device
	   number is one byte, you can't go above 256).

	2) The limit on the number of pseudo-ttys that programs using
	   pseudo-ttys will actually look at.  Those programs find a
	   free pseudo-tty by trying to open the "master" side of all
	   the system's pseudo-ttys until they succeed in opening one. 
	   They start by trying to open "/dev/ptyp0", and cycle up,
	   generally, through "/dev/ptysf".  That's a total of 64; they
	   only look at the first 64.  That limit is still present in
	   SunOS 4.0.