From owner-freebsd-bugs Tue Oct 15 06:20:07 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id GAA07708 for bugs-outgoing; Tue, 15 Oct 1996 06:20:07 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id GAA07679; Tue, 15 Oct 1996 06:20:05 -0700 (PDT) Resent-Date: Tue, 15 Oct 1996 06:20:05 -0700 (PDT) Resent-Message-Id: <199610151320.GAA07679@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, davidn@blaze.net.au Received: from sdev.usn.blaze.net.au (sdev.usn.blaze.net.au [203.17.53.19]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id GAA07263; Tue, 15 Oct 1996 06:15:40 -0700 (PDT) Received: (from davidn@localhost) by sdev.usn.blaze.net.au (8.7.6/8.6.9) id XAA00663; Tue, 15 Oct 1996 23:15:09 +1000 (EST) Message-Id: <199610151315.XAA00663@sdev.usn.blaze.net.au> Date: Tue, 15 Oct 1996 23:15:09 +1000 (EST) From: davidn@sdev.usn.blaze.net.au Reply-To: davidn@blaze.net.au To: FreeBSD-gnats-submit@freebsd.org, sos@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/1811: Fix for syscons TIOCGWINSZ for non 80x25 text modes Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1811 >Category: kern >Synopsis: Patch to correct rows/columns for syscons >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 15 06:20:02 PDT 1996 >Last-Modified: >Originator: David Nugent - davidn@blaze.net.au >Organization: Unique Computing, Melbourne, Australia >Release: FreeBSD 2.2-961004-SNAP i386 >Environment: VGA/EGA text modes other than 80x25 >Description: If vidcontrol (or some other means) is used to change the current video mode from the default 80x25 lines, the window size reported via TIOCGWINSZ is correctly changed. However, this is reset by the tty driver on logout. Subsequently logging in on the vt will show (again) the default rows 0 columns 0 parameters, with the result that applications will not know the *correct* window size of the vt and use the default sizes from termcap with consequent aberrant behaviour. To fix, the user needs to run vidcontrol again, or stty with the correct values. >How-To-Repeat: (assuming an 8x8 console font has been loaded) /usr/sbin/vidcontrol VGA-80x50 logout (log in again) stty -a (shows speed 115200 baud; 0 rows; 0 columns) Run more, less etc. and watch the confusion. :) >Fix: The following patch works around the problem by copying the correct console rows/columns into the tty driver structure if the rows/columns fields are currently 0 (ie. the have not been set). This removes the anomaly, but does not interfere with the user being able to override these values via the /bin/stty interace so long as they are not reset to 0,0. *** sys/i386/isa/syscons.c.orig Tue Oct 15 15:45:49 1996 --- sys/i386/isa/syscons.c Tue Oct 15 21:27:48 1996 *************** *** 1256,1261 **** --- 1256,1274 ---- return ENXIO; default: break; + + case TIOCGWINSZ: /* We may know more about this */ + /* We only modify the tty structure for the console + * size if it hasn't been set to something different + * by the user + */ + if (!tp->t_winsize.ws_row && !tp->t_winsize.ws_col) + { + tp->t_winsize.ws_row = scp->ysize; + tp->t_winsize.ws_col = scp->xsize; + } + break; + } error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); David Nugent, Unique Computing Pty Ltd - Melbourne, Australia Voice +61-3-791-9547 Data/BBS +61-3-792-3507 3:632/348@fidonet davidn@blaze.net.au http://www.blaze.net.au/~davidn >Audit-Trail: >Unformatted: