Date: 17 Feb 2001 17:49:10 +0100 From: Cyrille Lefevre <clefevre@poboxes.com> To: "Steve O'Hara-Smith" <steveo@eircom.net> Cc: Robert bobb Crosbie <bobb+freebsd-stable@redbrick.dcu.ie>, freebsd-stable@FreeBSD.ORG Subject: Re: More than 256 pty's Message-ID: <66i9w8zd.fsf@gits.dyndns.org> In-Reply-To: "Steve O'Hara-Smith"'s message of "Fri, 16 Feb 2001 20:27:37 %2B0100" References: <20010216172854.A67979@enigma.redbrick.dcu.ie> <20010216202737.1807da64.steveo@eircom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
"Steve O'Hara-Smith" <steveo@eircom.net> writes:
> On Fri, 16 Feb 2001 17:28:54 +0000
> Robert bobb Crosbie <bobb+freebsd-stable@redbrick.dcu.ie> wrote:
> RC> <quote>
> RC> You can have more than 256 ptys; the problem is what to name them. You
> RC> can easily get 384 ptys by extending the current scheme slightly (using
> RC> /dev/tty[tuTU]*; /dev/ttyv* is syscons so we hit our limit with this
> RC> naming scheme). Edit /dev/MAKEDEV and /usr/src/lib/libutil/pty.c
> RC> </quote>
>
> It looks to me like you also have to hack around in kern/tty_pty.c,
> there are hard coded assumptions in there about 256 minor numbers being mapped.
> Also comments about doing something about it, the mapping is defined in there.
> Making it work above 256 doesn't look hard, agreeing on a naming convention
> might be harder :)
Index: etc/MAKEDEV
===================================================================
RCS file: /home/ncvs/src/etc/MAKEDEV,v
retrieving revision 1.243.2.20
diff -u -r1.243.2.20 MAKEDEV
--- etc/MAKEDEV 2001/02/03 16:16:40 1.243.2.20
+++ etc/MAKEDEV 2001/02/17 16:45:35
@@ -701,23 +701,13 @@
done
;;
pty*)
- class=`expr $i : 'pty\(.*\)'`
- case $class in
- 0) offset=0 name=p;;
- 1) offset=32 name=q;;
- 2) offset=64 name=r;;
- 3) offset=96 name=s;;
-# Note that xterm (at least) only look at p-s.
- 4) offset=128 name=P;;
- 5) offset=160 name=Q;;
- 6) offset=192 name=R;;
- 7) offset=224 name=S;;
- # This still leaves [tuTU].
- *) echo bad unit for pty in: $i;;
- esac
umask 0
+ class=`expr $i : 'pty\(.*\)'`
case $class in
- 0|1|2|3|4|5|6|7)
+ [0-9]|1[0-9]|20)
+ name=$(echo pqrstuwxyzPQRSTUVWXYZ |
+ dd bs=1 skip=$class count=1 2>/dev/null)
+ offset=$(($class * 32))
i=0
while [ $i -lt 32 ]; do
# This was an awk substr() before.
@@ -728,6 +718,7 @@
i=$(($i + 1))
done
;;
+ *) echo bad unit for pty in: $i;;
esac
umask 77
;;
Index: lib/libutil/pty.c
===================================================================
RCS file: /home/ncvs/src/lib/libutil/pty.c,v
retrieving revision 1.10
diff -u -r1.10 pty.c
--- lib/libutil/pty.c 1999/08/28 00:05:51 1.10
+++ lib/libutil/pty.c 2001/02/17 16:45:49
@@ -70,7 +70,7 @@
else
ttygid = -1;
- for (cp1 = "pqrsPQRS"; *cp1; cp1++) {
+ for (cp1 = "pqrstuwxyzPQRSTUVWXYZ"; *cp1; cp1++) {
line[8] = *cp1;
for (cp2 = "0123456789abcdefghijklmnopqrstuv"; *cp2; cp2++) {
line[5] = 'p';
Index: share/man/man4/pty.4
===================================================================
RCS file: /home/ncvs/src/share/man/man4/pty.4,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 pty.4
--- share/man/man4/pty.4 2000/12/08 14:59:07 1.8.2.1
+++ share/man/man4/pty.4 2001/02/17 16:46:15
@@ -191,10 +191,10 @@
is required.
.El
.Sh FILES
-.Bl -tag -width /dev/tty[p-sP-S][0-9a-v]x -compact
-.It Pa /dev/pty[p-sP-S][0-9a-v]
+.Bl -tag -width /dev/tty[p-uw-zP-Z][0-9a-v]x -compact
+.It Pa /dev/pty[p-uw-zP-Z][0-9a-v]
master pseudo terminals
-.It Pa /dev/tty[p-sP-S][0-9a-v]
+.It Pa /dev/tty[p-uw-zP-Z][0-9a-v]
slave pseudo terminals
.El
.Sh DIAGNOSTICS
Index: sys/kern/tty_pty.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/tty_pty.c,v
retrieving revision 1.74
diff -u -r1.74 tty_pty.c
--- sys/kern/tty_pty.c 2000/02/09 03:32:11 1.74
+++ sys/kern/tty_pty.c 2001/02/17 16:47:08
@@ -130,8 +130,8 @@
/*
* This function creates and initializes a pts/ptc pair
*
- * pts == /dev/tty[pqrsPQRS][0123456789abcdefghijklmnopqrstuv]
- * ptc == /dev/pty[pqrsPQRS][0123456789abcdefghijklmnopqrstuv]
+ * pts == /dev/tty[pqrstuwxyzPQRSTUVWXYZ][0123456789abcdefghijklmnopqrstuv]
+ * ptc == /dev/pty[pqrstuwxyzPQRSTUVWXYZ][0123456789abcdefghijklmnopqrstuv]
*
* XXX: define and add mapping of upper minor bits to allow more
* than 256 ptys.
@@ -141,7 +141,7 @@
int n;
{
dev_t devs, devc;
- char *names = "pqrsPQRS";
+ char *names = "pqrstuwxyzPQRSTUVWXYZ";
struct pt_ioctl *pt;
/* For now we only map the lower 8 bits of the minor */
also, how about using an OID to dynamicaly configure available ptys ?
something like kern.nptys=384 or more w/ a maximum of 704 ptys ((z-p)*2*32).
Cyrille.
--
home: mailto:clefevre@poboxes.com UNIX is user-friendly; it's just particular
work: mailto:Cyrille.Lefevre@edf.fr about who it chooses to be friends with.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?66i9w8zd.fsf>
