aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2012-01-05 04:06:11 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-24 17:01:01 -0500
commite9aba5158a80098447ff207a452a3418ae7ee386 (patch)
treefb6dd19824f908746d597128d34093a301c005e7 /include/linux/tty.h
parenta4834c102f4a46808630cad1a545cb0706b3b0a2 (diff)
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>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d3ebd765b548..d40774188203 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -52,6 +52,7 @@
52 * hardcoded at present.) 52 * hardcoded at present.)
53 */ 53 */
54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
55#define NR_UNIX98_PTY_RESERVE 1024 /* Default reserve for main devpts */
55#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 56#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
56 57
57/* 58/*