From owner-freebsd-bugs Tue Apr 3 21:20:10 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 7E08B37B718 for ; Tue, 3 Apr 2001 21:20:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f344K3s97406; Tue, 3 Apr 2001 21:20:03 -0700 (PDT) (envelope-from gnats) Date: Tue, 3 Apr 2001 21:20:03 -0700 (PDT) Message-Id: <200104040420.f344K3s97406@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Cyrille Lefevre Subject: Re: kern/25866: more than 256 ptys, up to 1302 ptys. Reply-To: Cyrille Lefevre Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/25866; it has been noted by GNATS. From: Cyrille Lefevre To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: kern/25866: more than 256 ptys, up to 1302 ptys. Date: Wed, 4 Apr 2001 06:10:40 +0200 (CEST) the following patch correct a typo in MAKEDEV. Index: /usr/src/etc/MAKEDEV =================================================================== RCS file: /home/ncvs/src/etc/MAKEDEV,v retrieving revision 1.243.2.28 diff -u -r1.243.2.28 MAKEDEV --- /usr/src/etc/MAKEDEV 2001/03/27 22:14:53 1.243.2.28 +++ /usr/src/etc/MAKEDEV 2001/04/03 10:39:38 @@ -231,6 +231,19 @@ echo $(((($1 >> 8) << 16) | ($1 % 256))) } +# Convert pty (class,instance) to minor number +# Handle pty minor numbers greater than 256 +ptyminor() +{ + echo $(( (( ($1 + $2) &~ 255) << 8) | (($1 + $2) & 255) )) +} + +# *MUST* be the same as in sys/kern/tty_pty.c and lib/libutil/pty.c +ptyclassnames=pqrstuwxyzPQRSTUVWXYZ +ptyinstancenames=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ +nptyclass=${#ptyclassnames} +nptyinstance=${#ptyinstancenames} + # Raw partition for disks dkrawpart=2 @@ -707,34 +720,26 @@ 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 - case $class in - 0|1|2|3|4|5|6|7) + class=`expr $i : 'pty\(.*\)'` + if [ -n "$class" -a "$class" -lt $nptyclass ]; then + name=$(echo $ptyclassnames | + dd bs=1 skip=$class count=1 2>/dev/null) + offset=$(($class * $nptyinstance)) i=0 - while [ $i -lt 32 ]; do + while [ $i -lt $nptyinstance ]; do # This was an awk substr() before. - c=$(echo 0123456789abcdefghijklmnopqrstuv | + c=$(echo $ptyinstancenames | dd bs=1 skip=$i count=1 2>/dev/null) - mknod tty$name$c c 5 $(($offset + $i)) - mknod pty$name$c c 6 $(($offset + $i)) + minor=$(ptyminor $offset $i) + rm -f tty$name$c pty$name$c + mknod tty$name$c c 5 $minor + mknod pty$name$c c 6 $minor i=$(($i + 1)) done - ;; - esac + else + echo bad unit for pty in: $i + fi umask 77 ;; 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-bugs" in the body of the message