]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-pts.patch
- obsolete
[packages/kernel.git] / kernel-pts.patch
CommitLineData
e425e4be
PG
1diff -ur linux-2.6.5-virgin/drivers/char/tty_io.c linux-2.6.5-eviltron/drivers/char/tty_io.c
2--- linux-2.6.5-virgin/drivers/char/tty_io.c 2004-05-07 03:39:25.085624064 -0600
3+++ linux-2.6.5-eviltron/drivers/char/tty_io.c 2004-05-07 03:37:51.697821168 -0600
4@@ -1362,14 +1362,25 @@
5 #ifdef CONFIG_UNIX98_PTYS
6 if (device == MKDEV(TTYAUX_MAJOR,2)) {
7 /* find a device that is not in use. */
8- static int next_ptmx_dev = 0;
9+ static int next_ptmx_dev = MAX_PREFERRED_PTY;
10 retval = -1;
11 driver = ptm_driver;
12- while (driver->refcount < pty_limit) {
13- index = next_ptmx_dev;
14- next_ptmx_dev = (next_ptmx_dev+1) % driver->num;
15- if (!init_dev(driver, index, &tty))
16- goto ptmx_found; /* ok! */
17+ /* first, try and allocate a pty < 256 for old glibc */
18+ for (index = 0; index < MAX_PREFERRED_PTY && driver->refcount < pty_limit && index < driver->num; index++) {
19+ if (!init_dev(driver, index, &tty))
20+ goto ptmx_found;
21+ }
22+ /* nothing below MAX_PREFERRED_PTY, try something higher, unless
23+ * we've already run out of options */
24+ if (index != driver->num) {
25+ while (driver->refcount < pty_limit) {
26+ index = next_ptmx_dev;
27+ next_ptmx_dev = (next_ptmx_dev+1) % driver->num;
28+ if (!next_ptmx_dev)
29+ next_ptmx_dev = MAX_PREFERRED_PTY;
30+ if (!init_dev(driver, index, &tty))
31+ goto ptmx_found; /* ok! */
32+ }
33 }
34 return -EIO; /* no free ptys */
35 ptmx_found:
36diff -ur linux-2.6.5-virgin/include/linux/tty.h linux-2.6.5-eviltron/include/linux/tty.h
37--- linux-2.6.5-virgin/include/linux/tty.h 2004-05-07 03:39:26.953340128 -0600
38+++ linux-2.6.5-eviltron/include/linux/tty.h 2004-05-07 01:43:55.000000000 -0600
39@@ -35,6 +35,7 @@
40 #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
41 #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
42 #define NR_LDISCS 16
43+#define MAX_PREFERRED_PTY 256 /* we prefer to allocate ptys beneath this number */
44
45 /*
46 * These are set up by the setup-routine at boot-time:
47
This page took 0.06612 seconds and 4 git commands to generate.