[POWERPC] Xilinx: hwicap driver
[sfrench/cifs-2.6.git] / drivers / char / pty.c
index c07a1b5cd05d3f31204fab9eb7810e9704d96e08..706ff34728f19382be4215e25e3052bd2b1ba371 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/module.h>      /* For EXPORT_SYMBOL */
 
 #include <linux/errno.h>
-#include <linux/sched.h>
 #include <linux/interrupt.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
@@ -249,14 +248,19 @@ static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file,
        return -ENOIOCTLCMD;
 }
 
+static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
+module_param(legacy_count, int, 0);
+
 static void __init legacy_pty_init(void)
 {
+       if (legacy_count <= 0)
+               return;
 
-       pty_driver = alloc_tty_driver(NR_PTYS);
+       pty_driver = alloc_tty_driver(legacy_count);
        if (!pty_driver)
                panic("Couldn't allocate pty driver");
 
-       pty_slave_driver = alloc_tty_driver(NR_PTYS);
+       pty_slave_driver = alloc_tty_driver(legacy_count);
        if (!pty_slave_driver)
                panic("Couldn't allocate pty slave driver");
 
@@ -314,7 +318,7 @@ int pty_limit = NR_UNIX98_PTY_DEFAULT;
 static int pty_limit_min = 0;
 static int pty_limit_max = NR_UNIX98_PTY_MAX;
 
-ctl_table pty_table[] = {
+static struct ctl_table pty_table[] = {
        {
                .ctl_name       = PTY_MAX,
                .procname       = "max",
@@ -336,6 +340,27 @@ ctl_table pty_table[] = {
        }
 };
 
+static struct ctl_table pty_kern_table[] = {
+       {
+               .ctl_name       = KERN_PTY,
+               .procname       = "pty",
+               .mode           = 0555,
+               .child          = pty_table,
+       },
+       {}
+};
+
+static struct ctl_table pty_root_table[] = {
+       {
+               .ctl_name       = CTL_KERN,
+               .procname       = "kernel",
+               .mode           = 0555,
+               .child          = pty_kern_table,
+       },
+       {}
+};
+
+
 static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file,
                            unsigned int cmd, unsigned long arg)
 {
@@ -400,6 +425,7 @@ static void __init unix98_pty_init(void)
                panic("Couldn't register Unix98 pts driver");
 
        pty_table[1].data = &ptm_driver->refcount;
+       register_sysctl_table(pty_root_table);
 }
 #else
 static inline void unix98_pty_init(void) { }