Date: Tue, 3 Apr 2001 21:20:03 -0700 (PDT) From: Cyrille Lefevre <root@gits.dyndns.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/25866: more than 256 ptys, up to 1302 ptys. Message-ID: <200104040420.f344K3s97406@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/25866; it has been noted by GNATS. From: Cyrille Lefevre <root@gits.dyndns.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104040420.f344K3s97406>