Alan Hargreaves' Blog

The ramblings of an Australian SaND TSC* Principal Field Technologist

Pseudo-Terminal Allocation Before Solaris 8

My brother was having some problems with his Solaris 7 systems running out of pty’s. We managed another workaround that enabled him to login and sort things out (which I might discuss later), but he’d been searching the web for information on this and turned up www.xegypt.net/articles/os/ptys.txt. I’m going to quote part of the page, but before I do, Let me say this right now, …

DO NOT DO THIS. IT IS RISKY, WRONG AND YOU COULD PANIC YOUR SYSTEM.

The riskier way, and which I have personally confirmed to be working is done
on-the-fly by writing symbols in the kernel image. Advantage? You don’t have to
reboot. As root, type this:

#adb -k -w /dev/ksyms /dev/mem
pt_cnt/W80
npty/W80
$q

The problem with doing this is that Solaris uses the boot-time values to allocate various structures associated with ptys, including a number of arrays (ptms_tty[] and pty_softc[]). If we change pt_cnt and/or npty on the fly, we risk working with memory beyond what was allocated to these arrays.

At best it will write over some data that we aren’t using. At worst we could panic the box by writing to unmapped memory, or worse again, we could silently modify data associated with another part of the kernel.

The only way to increase the number of ptys on Solaris 7 and earlier involves a reboot and is the first method that he recommended.

The more reliable way to do this is to append the following two lines in
/etc/system and rebooting:

set npty=128
set pt_cnt=128

The issue went away with Solaris 8, at that point pty allocation became dynamic.

Technorati Tag:

Advertisements

Written by Alan

April 10, 2005 at 7:24 pm

Posted in Solaris

2 Responses

Subscribe to comments with RSS.

  1. Alan,
    note that npty has nothing to do with the problem
    you are describing. It controls the number of BSD ptys.
    For some reason the legend always suggest adjusting npty together with pt_cnt.

    Alexander Kolbasov

    May 13, 2005 at 1:06 pm

  2. Yes, this is true, however, as you also mention, it’s always been regarded as a “good practice” to keep these two in sync.
    Alan.

    Alan Hargreaves

    May 15, 2005 at 3:51 pm


Comments are closed.

%d bloggers like this: