From traister@manta.mojozone.org  Thu Jul 24 20:31:02 1997
Received: from manta.mojozone.org (root@dfbfl1-6.gate.net [198.206.135.133])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id UAA11056
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Jul 1997 20:30:59 -0700 (PDT)
Received: (from traister@localhost)
	by manta.mojozone.org (8.8.6/8.8.6) id XAA05743;
	Thu, 24 Jul 1997 23:30:54 -0400 (EDT)
Message-Id: <199707250330.XAA05743@manta.mojozone.org>
Date: Thu, 24 Jul 1997 23:30:54 -0400 (EDT)
From: Joe Traister <traister@mojozone.org>
Reply-To: traister@mojozone.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: pcvt VT_WAITACTIVE ioctl busted
X-Send-Pr-Version: 3.2

>Number:         4164
>Category:       kern
>Synopsis:       pcvt VT_WAITACTIVE ioctl busted
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    joerg
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 24 20:40:01 PDT 1997
>Closed-Date:    Sun Sep 14 21:02:25 MEST 1997
>Last-Modified:  Sun Sep 14 21:03:15 MEST 1997
>Originator:     Joe Traister
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
None
>Environment:

	FreeBSD 2.2.2-RELEASE with pcvt console

>Description:

	The pcvt VT_WAITACTIVE ioctl, when passed a 0 third argument,
	puts the calling process to sleep until the current vt is
	switched away from.  The syscons driver, when passed a 0 third
	argument, waits until the vt represented by the passed file
	descriptor is switched to.  Both claim to be USL-compatible.
	I wasn't sure which was correct, but the latter behavior seems
	more useful, since the former doesn't care whether the current
	vt is related to the calling process or not.  Also, a comment
	in the pcvt code makes it clear that the author was unsure of
	the correct behavior.

>How-To-Repeat:

	A code example would be rather involved, but can be provided.
	A comparison of the code in scioctl() in i386/isa/syscons.c and
	usl_vt_ioctl() in i386/isa/pcvt/pcvt_ext.c is straightforward.

>Fix:

*** pcvt_ext.c.dist	Mon Jul 21 19:06:36 1997
--- pcvt_ext.c	Mon Jul 21 20:40:58 1997
***************
*** 2653,2661 ****
  		if(i == -1)
  		{
- 			/* xxx Is this what it is supposed to do? */
  			int x = spltty();
! 			i = current_video_screen;
  			error = 0;
! 			while (current_video_screen == i &&
  			       (error == 0 || error == ERESTART)) {
  				vs[i].vt_status |= VT_WAIT_ACT;
--- 2653,2660 ----
  		if(i == -1)
  		{
  			int x = spltty();
! 			i = minor(dev);
  			error = 0;
! 			while (current_video_screen != i &&
  			       (error == 0 || error == ERESTART)) {
  				vs[i].vt_status |= VT_WAIT_ACT;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->joerg 
Responsible-Changed-By: joerg 
Responsible-Changed-When: Thu Jul 31 23:18:55 MEST 1997 
Responsible-Changed-Why:  
I've been the last one mucking with kernel sppp, so i'll deal with 
this problem.  The submitted patch looks simple enough... 

From: j@uriah.heep.sax.de (J Wunsch)
To: freebsd-gnats-submit@FreeBSD.ORG
Cc: traister@mojozone.org
Subject: Re: kern/4164
Date: Thu, 31 Jul 1997 23:25:12 +0200

 As Joerg Wunsch wrote:
 
 > Synopsis: pcvt VT_WAITACTIVE ioctl busted
 > 
 > Responsible-Changed-From-To: freebsd-bugs->joerg
 > Responsible-Changed-By: joerg
 > Responsible-Changed-When: Thu Jul 31 23:18:55 MEST 1997
 > Responsible-Changed-Why: 
 > I've been the last one mucking with kernel sppp, so i'll deal with
 > this problem.  The submitted patch looks simple enough...
 
 Needless to say, i've totally confused this one.  :-<>  Anyway, still
 my field, since i'm supposed to handle pcvt problems...
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sun Sep 14 21:02:25 MEST 1997 
State-Changed-Why:  

Suggested fix applied in rev 1.13 of pcvt_ext.c.  Thanks! 
(Well, i actually collapsed the code a little afterwards.) 
>Unformatted:
