Regarding the Pseudo terminal limit on Fedora linux kernel

C. Linus Hicks lhicks at nc.rr.com
Wed Mar 2 16:03:08 UTC 2005


On Wed, 2005-03-02 at 17:47 +0530, Reddy V, Ravinder (Ravinder) wrote:
> Hi,
> 
>  Can anyone please let me know the system variable which holds the pseudo
> terminal limit in fedora linux.
> Also please let me know the filename where this variable is present, and how
> to change this variable value?

If you look in Documentation/devices.txt in the kernel sources, you will
see that device major numbers 136-143 reserved for Unix98 pseudo-TTY
devices. That makes 8 x 256 total available under the current device
allocation scheme.

However, if you look in include/linux/tty.h you see this:

#define NR_UNIX98_PTY_DEFAULT   4096      /* Default maximum for Unix98 ptys */
#define NR_UNIX98_PTY_MAX       (1 << MINORBITS) /* Absolute limit */

and in include/linux/kdev_t.h

#define MINORBITS      20

Which gives a maximum of 1048576. So then looking in drivers/char/pty.c

/* Unix98 devices */
#ifdef CONFIG_UNIX98_PTYS
/*
 * sysctl support for setting limits on the number of Unix98 ptys allocated.
 * Otherwise one can eat up all kernel memory by opening /dev/ptmx repeatedly.
 */
int pty_limit = NR_UNIX98_PTY_DEFAULT;
static int pty_limit_min = 0;
static int pty_limit_max = NR_UNIX98_PTY_MAX;

And from sysctl:

kernel.pty.max = 4096

So you can set it either by echoing a value into:

/proc/sys/kernel/pty/max

Or by using

sysctl -w kernel.pty.max=<value>

If you want to set it permanently, add a line to /etc/sysctl.conf and it
will get loaded at boot time.

-- 
C. Linus Hicks <lhicks at nc dot rr dot com>




More information about the users mailing list