SUMMARY: Out of ptys

Date: Wed Mar 02 1994 - 10:01:16 CST

A couple of days ago, I asked how to increase the number of ptys
on one of our systems. I couldn't find it in any FMs that I'd read.

Many thanks for the speedy responses! Turns out that this is a two
step process:

1. Modify the kernel config file to change the line "pseudo-device pty"
        pseudo-device pty # pseudo-tty's...
        pseudo-device pty255 # pseudo-tty's...

    and then make and install the new kernel. The default is
    to have 48 ptys: ttyp[0-f], ttyq[0-f], and ttyr[0-f].

    NOTE: Many people suggested using "pty256" here, but Sun's
           FAQ document (which apparently is can be found in Sunsolve),
           warns in question #57 that the maximum number is 255, as 256
           wraps to 0. Judging by the responses, many people are not
           aware of this.

2. Make device special files for the new ptys. You create these files in
    sets of 16 using the MAKEDEV command. As mentioned above, the system
    comes with 48 ptys defined by default, 3 sets of 16 ptys each: 0, 1,
    and 2. The easiest way to create the rest of them all at once is to
    do the following as root:

         foreach i (3 4 5 6 7 8 9 10 11 12 13 14 15 16)
             /dev/MAKEDEV pty$i

    You can safely ignore any messages saying, "mknod: File exists".
    Note that you can start with 3 above, not 0.

One person suggested hacking the tty_ptyconf.c file to check to see if
NPTY == 1, and if so, change it to 256. I thought that changing the
actual kernel config file would be cleaner, so I didn't try this.

Peter A. Starceski ( suggested a different way to
modify the kernel config file. He suggested adding the line

        options npty=256

at the end of the file. (Should this really be 255?). I did not
try this, as the above method worked for me.

I had also asked how I could determine how many ptys I currently had
allocated, and how many of those were in use at any given time. Several
people told me the answer to the first question, and I figured out the
second one myself.

How to determine how many ptys you have allocated:

        ls /dev/pty?? | wc

How to determine how many ptys are currently in use:

        w | tail +3 | grep tty | wc

I'm still confused why none of this is in the man pages under pty, or
even that it's relatively undocumented in the kernel config file.

Many thanks to the following people:

Peter Samuel
Birger A. Wathne
Derek Seymour
Eamonn McGonigle
Russell David
Peter A. Starceski
Scott Stevens
Robert Pekarski
Ric Anderson
Glenn Satchell
Joseph Youn
Sean Ward

and no thanks to one person who sent me a chain letter instead of
anything remotely connected with either Unix or SunOS.

Mike van der Velden               email:
Glenayre Electronics, Ltd.        phone:  604-293-1611, x243
Vancouver, BC.  V5K 5B8           fax:    604-293-4317

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:57 CDT