Subject: DZ driver missing 8bit support, getty missing NoParity option, login loses 8bit flag(s) from getty (#480) Index: src/sys/pdpuba/dz.c src/bin/login/login.c src/libexec/getty/gettylab.h,init.c,subr.c src/man/man4/tty.4 src/man/nan5/gettytab.5 Description: Lightly edited from bqt@softjar.se's submission: The reason these came about was because someone was using simh to play with 2.11BSD and they got hold of some graphics terminal which used some kind of protocol that used bytes with the high bit set... and the guy could not get things working under 2.11BSD... ...To make the long story short, turns out the DZ driver (and only that one) did not allow output of characters with the high bit set even when PASS8 was requested. ...I figured I'd be nice and also add 'np' to getty. ...I could not get it working. Turns out login resets the local flags word so anything set via gettytab is always lost...fix login to restore the getty's settings. and finally a minor cleanup of the tty(4) man-page. Repeat-By: 1. If you have a terminal that shows Latin-1 characters, do the following at shell prompt: printf "\344\n" Try with and without pass8 enabled. Without, you should see a "v". With pass8, you should see a small "a umlaut". However with the dz driver you will instead see nothing. If a user is using a terminal that does UTF-8 you'll need to create a difference test sequence. An alternate method is by observation. Read the the DZ driver source and notice PASS8 does not appear anywhere in dz.c 2. Read the gettytab manpage and/or source and observe lack of support for 'np'. 3. Try adding for example ":dx:" to the default entry in /etc/gettytab, then log in. Notice that decctlq is still prefixed with '-' meaning it is not enabled indicating login has reset/lost settings from getty. Fix: Cut where indicated and save to a file (/tmp/480.patch). Then: cd / patch -p0 < /tmp/480.patch cd /usr/src/bin/login make install make clean cd /usr/src/libexec/getty make install make clean cd /usr/src/man/man4 /usr/man/manroff tty.4 > tty.0 install -o bin -o bin -m 444 tty.0 /usr/man/cat4 cd /usr/src/man/man5 /usr/man/manroff gettytab.5 > gettytab.0 install -o bin -o bin -m 444 gettytab.0 /usr/man/cat5 Recompile the kernel if the DZ driver is being used. The process should be familiar by this time ;) Something like this: cd /sys/YOUR_KERNEL make install -c -m 644 -o root -g wheel unix / install -c -m 644 -o root -g wheel netnix / make clean A reboot will get the new getty running as well as the updated kernel reboot Clean up the system by removing the '~' files created during the patching: rm ./usr/src/sys/pdpuba/dz.c~ and so on This and previous updates to 2.11BSD are available at the following locations: ftp://ftp.dfupdate.se/pub/pdp11/2.11BSD https://www.tuhs.org/Archive/Distributions/UCB/2.11BSD/Patches/ ftp://ftp.2bsd.com/2.11BSD ---------------------------cut here-------------------- *** ./usr/src/sys/pdpuba/dz.c.old Fri Feb 14 23:06:11 1997 --- ./usr/src/sys/pdpuba/dz.c Thu Apr 13 06:23:01 2023 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)dz.c 1.4 (2.11BSD GTE) 1997/2/14 */ /* --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)dz.c 1.5 (2.11BSD) 2023/4/13 */ /* *************** *** 120,125 **** --- 120,126 ---- { register struct tty *tp; register int unit; + register int s; unit = UNIT(dev); if (unit >= NDZLINE || dzpdma[unit].pd_addr == 0) *************** *** 153,164 **** else dzsoftCAR[unit >> 3] &= ~(1<<(unit&07)); #endif ! (void) _spl5(); while ((tp->t_state & TS_CARR_ON) == 0) { tp->t_state |= TS_WOPEN; sleep((caddr_t)&tp->t_rawq, TTIPRI); } ! (void) _spl0(); return ((*linesw[tp->t_line].l_open)(dev, tp)); } --- 154,165 ---- else dzsoftCAR[unit >> 3] &= ~(1<<(unit&07)); #endif ! s = spltty(); while ((tp->t_state & TS_CARR_ON) == 0) { tp->t_state |= TS_WOPEN; sleep((caddr_t)&tp->t_rawq, TTIPRI); } ! splx(s); return ((*linesw[tp->t_line].l_open)(dev, tp)); } *************** *** 414,420 **** dp = (struct pdma *)tp->t_addr; dzaddr = dp->pd_addr; ! s = spl5(); if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) goto out; if (tp->t_outq.c_cc <= TTLOWAT(tp)) { --- 415,421 ---- dp = (struct pdma *)tp->t_addr; dzaddr = dp->pd_addr; ! s = spltty(); if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) goto out; if (tp->t_outq.c_cc <= TTLOWAT(tp)) { *************** *** 430,436 **** } if (tp->t_outq.c_cc == 0) goto out; ! if (tp->t_flags & (RAW|LITOUT)) cc = ndqb(&tp->t_outq, 0); else { cc = ndqb(&tp->t_outq, 0200); --- 431,437 ---- } if (tp->t_outq.c_cc == 0) goto out; ! if (tp->t_flags & (RAW|LITOUT|PASS8)) cc = ndqb(&tp->t_outq, 0); else { cc = ndqb(&tp->t_outq, 0200); *************** *** 460,466 **** register int s; dp = (struct pdma *)tp->t_addr; ! s = spl5(); if (tp->t_state & TS_BUSY) { dp->p_end = dp->p_mem; if ((tp->t_state & TS_TTSTOP)==0) --- 461,467 ---- register int s; dp = (struct pdma *)tp->t_addr; ! s = spltty(); if (tp->t_state & TS_BUSY) { dp->p_end = dp->p_mem; if ((tp->t_state & TS_TTSTOP)==0) *************** *** 481,487 **** unit = UNIT(dev); b = 1<<(unit&7); dzaddr = dzpdma[unit].pd_addr; ! s = spl5(); mbits = (dzaddr->dzdtr & b) ? DZ_DTR : 0; mbits |= (dzaddr->dzmsr & b) ? DZ_CD : 0; mbits |= (dzaddr->dztbuf & b) ? DZ_RI : 0; --- 482,488 ---- unit = UNIT(dev); b = 1<<(unit&7); dzaddr = dzpdma[unit].pd_addr; ! s = spltty(); mbits = (dzaddr->dzdtr & b) ? DZ_DTR : 0; mbits |= (dzaddr->dzmsr & b) ? DZ_CD : 0; mbits |= (dzaddr->dztbuf & b) ? DZ_RI : 0; *************** *** 568,574 **** if (dzsilos == 0) return; ! s = spl5(); dzfasttimers++; /*DEBUG*/ for (dz = 0; dz < NDZ; dz++) if (dzsilos & (1 << dz)) --- 569,575 ---- if (dzsilos == 0) return; ! s = spltty(); dzfasttimers++; /*DEBUG*/ for (dz = 0; dz < NDZ; dz++) if (dzsilos & (1 << dz)) *** ./usr/src/bin/login/login.c.old Sat Sep 27 00:00:35 1997 --- ./usr/src/bin/login/login.c Thu Apr 13 06:23:01 2023 *************** *** 20,26 **** "@(#) Copyright (c) 1980, 1987, 1988 The Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)login.c 5.40.2 (2.11BSD GTE) 1997/9/26"; #endif /* --- 20,26 ---- "@(#) Copyright (c) 1980, 1987, 1988 The Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)login.c 5.41 (2.11BSD) 2023/4/13"; #endif /* *************** *** 95,101 **** register int ch; register char *p; int ask, fflag, hflag, pflag, cnt; ! int quietlog, passwd_req, ioctlval, timedout(); char *domain, *salt, *envinit[1], *ttyn, *pp; char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10]; char *ctime(), *ttyname(), *stypeof(), *crypt(), *getpass(); --- 95,101 ---- register int ch; register char *p; int ask, fflag, hflag, pflag, cnt; ! int quietlog, passwd_req, ioctlval, oldioctlval, timedout(); char *domain, *salt, *envinit[1], *ttyn, *pp; char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10]; char *ctime(), *ttyname(), *stypeof(), *crypt(), *getpass(); *************** *** 155,160 **** --- 155,161 ---- ask = 1; ioctlval = 0; + (void)ioctl(0, TIOCLGET, &oldioctlval); (void)ioctl(0, TIOCLSET, &ioctlval); (void)ioctl(0, TIOCNXCL, 0); (void)fcntl(0, F_SETFL, ioctlval); *************** *** 391,396 **** --- 392,399 ---- ioctlval = NTTYDISC; (void)ioctl(0, TIOCSETD, &ioctlval); } + + (void)ioctl(0, TIOCLSET, &oldioctlval); /* destroy environment unless user has requested preservation */ if (!pflag) *** ./usr/src/libexec/getty/gettytab.h.old Fri Mar 28 22:34:51 1997 --- ./usr/src/libexec/getty/gettytab.h Thu Apr 13 06:23:01 2023 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)gettytab.h 5.2.2 (2.11BSD GTE) 1997/3/28 */ /* --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)gettytab.h 5.3 (2.11BSD) 2023/4/13 */ /* *************** *** 98,104 **** #define UB gettyflags[16].value #define AB gettyflags[17].value #define DX gettyflags[18].value ! #define HF gettyflags[19].value int getent(); long getnum(); --- 98,105 ---- #define UB gettyflags[16].value #define AB gettyflags[17].value #define DX gettyflags[18].value ! #define HF gettyflags[19].value ! #define NP gettyflags[20].value int getent(); long getnum(); *** ./usr/src/libexec/getty/init.c.old Fri Mar 28 22:35:43 1997 --- ./usr/src/libexec/getty/init.c Thu Apr 13 06:23:01 2023 *************** *** 5,11 **** */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)init.c 5.2.2 (2.11BSD GTE) 1997/3/28"; #endif /* --- 5,11 ---- */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)init.c 5.3 (2.11BSD) 2023/4/13"; #endif /* *************** *** 82,86 **** --- 82,87 ---- { "ab", 0 }, /* auto-baud detect with '\r' */ { "dx", 0 }, /* set decctlq */ { "hf", 0 }, /* set HardwareFlowcontrol */ + { "np", 0 }, /* no parity (ie. pass8) */ { 0 } }; *** ./usr/src/libexec/getty/subr.c.old Fri Mar 28 23:02:25 1997 --- ./usr/src/libexec/getty/subr.c Thu Apr 13 06:23:01 2023 *************** *** 5,11 **** */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)subr.c 5.4.2 (2.11BSD GTE) 1997/3/28"; #endif /* --- 5,11 ---- */ #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)subr.c 5.5 (2.11BSD) 2023/4/13"; #endif /* *************** *** 179,184 **** --- 179,186 ---- f |= CTLECH; if (DX) f |= DECCTQ; + if (NP) + f |= PASS8; return (f); } *** ./usr/src/man/man4/tty.4.old Mon Apr 28 21:58:11 1997 --- ./usr/src/man/man4/tty.4 Thu Apr 13 06:26:09 2023 *************** *** 2,8 **** .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)tty.4 6.7.2 (2.11BSD GTE) 1997/4/10 .\" .TH TTY 4 "April 10, 1997" .UC 4 --- 2,8 ---- .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)tty.4 6.8 (2.11BSD) 2013/4/13 .\" .TH TTY 4 "April 10, 1997" .UC 4 *************** *** 467,473 **** defined in .IR : .PP ! .ta .5i 1i .nf .ft 3 struct sgttyb { --- 467,473 ---- defined in .IR : .PP ! .ta .3i 1i .nf .ft 3 struct sgttyb { *** ./usr/src/man/man5/gettytab.5.old Fri Mar 28 22:49:21 1997 --- ./usr/src/man/man5/gettytab.5 Thu Apr 13 06:23:01 2023 *************** *** 2,10 **** .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)gettytab.5 6.3.1 (2.11BSD) 1997/3/28 .\" ! .TH GETTYTAB 5 "March 28, 1997" .UC 5 .SH NAME gettytab \- terminal configuration data base --- 2,10 ---- .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)gettytab.5 6.4 (2.11BSD) 2023/4/13 .\" ! .TH GETTYTAB 5 "April 13, 2023" .UC 5 .SH NAME gettytab \- terminal configuration data base *************** *** 79,84 **** --- 79,85 ---- ln str ^V ``literal next'' character lo str /bin/login program to exec when name obtained nl bool false terminal has (or might have) a newline character + np bool false terminal uses no parity (i.e. 8-bit characters) nx str default next table (for auto speed selection) op bool false terminal uses odd parity os num unused output speed *** ./VERSION.old Mon Oct 31 07:35:35 2022 --- ./VERSION Wed Apr 12 21:52:45 2023 *************** *** 1,5 **** ! Current Patch Level: 479 ! Date: October 31, 2022 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 480 ! Date: April 13, 2023 2.11 BSD ============