]> git.baikalelectronics.ru Git - kernel.git/commit
tty: rework pty count limiting
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Thu, 5 Jan 2012 09:06:11 +0000 (13:06 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 24 Jan 2012 22:01:01 +0000 (14:01 -0800)
commit88580472c21534a3ae448c757d67949d601e6012
treefb6dd19824f908746d597128d34093a301c005e7
parent9aeb369bc02cf77e17cebcf2be611337295f18b9
tty: rework pty count limiting

After adding devpts multiple-insrances sysctl kernel.pty.max limit pty count for
each devpts instance independently, while kernel.pty.nr shows total pty count.

This patch restores sysctl kernel.pty.max as global limit (4096 by default),
adds pty reseve for main devpts (mounted without "newinstance" argument),
and new sysctl to tune it: kernel.pty.reserve (1024 by default)

Also it adds devpts mount option "max=%d" to limit pty count for each devpts
instance independently. (by default NR_UNIX98_PTY_MAX == 2^20)

Thus devpts instances in containers cannot eat up all available pty even if we didn't
set any limits, while with "max" argument we can adjust limits more precisely.

Plus, now open("/dev/ptmx") return -ENOSPC in case lack of pty indexes,
this is more informative than -EIO.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/devpts/inode.c
include/linux/tty.h