Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2006 11:56:09 -0700
From:      Eric Brunson <brunson@brunson.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Increasing ptys/ttys beyond 128
Message-ID:  <45804CC9.7090807@brunson.com>
In-Reply-To: <20061213183051.GA79921@owl.midgard.homeip.net>
References:  <45803B96.5090402@brunson.com> <20061213183051.GA79921@owl.midgard.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Erik Trulsson wrote:
> On Wed, Dec 13, 2006 at 10:42:46AM -0700, Eric Brunson wrote:
>   
>> I've done some searching on the web, but everything I've come across is 
>> either out of date and says to recompile the kernel, or else says that 
>> after 5.1 the devfs does it automatically.  I don't think that's the case.
>>
>> I'm running 6.1 and I need more than the [pt]ty[p-sP-S] devices that 
>> will auto-clone in devfs.
>>
>> I've tried adding lines like the following to /etc/default/devfs.rules:
>>
>> add path 'ptyt*' unhide
>> add path 'ttyt*' unhide
>>
>> But that doesn't do the trick.  The syntax "unhide" implies to me that 
>> the [p-sP-S] nodes exist but but are hidden by the hide_all ruleset.
>>
>> What do I have to do to allow the creation of more ptys?
>>     
>
> I don't think you can have more than 256 pty devices in 6.1
>
> The code in the kernel that handles ptys only allow for pty[pqrsPQRS][0-9a-v]
> (and the corresponding tty[pqrsPQRS][0-9a-v] of course.)  This gives you a
> total of 8*32 = 256 pty devices. (Not 128 as the subjectline implies.)
>   

Actually, that is incredibly helpful.  We're having problems with 
expect, but when expect searches for a free pty, it only searches 
[0-9a-f], which only gives us 128 ptys.  There's another problem with 
this search resulting in failures after 64 pty allocations which I was 
trying to avoid patching in expect, but if I can get 256 processes out 
of it, I'll patch away.

Man, 5 days of searching the web and you set me straight in 48 
minutes... I should have started here first.  :-)

Thanks a *ton*!

> (I don't think you could have more than 256 ptys back in 4.x either, but
>  back then the default setup only gave you 32 ptys, and all the instructions 
>  I have seen for increasing that number only told how to let you use all 256
>  possible devices, but not more than that.)
>
>
> To get more ptys than 256 you will have to start hacking the kernel.  (There
> does seem to be an alternate naming system for ptys available in 7-CURRENT
> but it has not been back-ported to 6.x.  See the pty(4) manpage from
> -CURRENT for details on how it works.




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