Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Mar 2018 09:46:09 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r330836 - stable/11/sys/dev/syscons
Message-ID:  <201803130946.w2D9k9sN004152@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Tue Mar 13 09:46:09 2018
New Revision: 330836
URL: https://svnweb.freebsd.org/changeset/base/330836

Log:
  MFC r304165,r304166:
  
  Like scr_lock, the grab count needs to be per-physical-device to work.
  
  This bug corrupted the grab count on both vtys if the ungrabbed vty is
  different from the console, and failed to restore the keyboard state
  on the ungrabbed vty, but not restoring the latter usually left the
  keyboard mode part of it uncorrupted at 1 (K_XLATE), while after this
  fix the keyboard mode part is usually corrupted to 0 (K_RAW).
  
  While here, rename the grab count from 'grabbed' to grab_level.

Modified:
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/syscons.c
==============================================================================
--- stable/11/sys/dev/syscons/syscons.c	Tue Mar 13 09:42:33 2018	(r330835)
+++ stable/11/sys/dev/syscons/syscons.c	Tue Mar 13 09:46:09 2018	(r330836)
@@ -1661,7 +1661,7 @@ sc_cngrab(struct consdev *cp)
     if (scp->sc->kbd == NULL)
 	return;
 
-    if (scp->grabbed++ > 0)
+    if (scp->sc->grab_level++ > 0)
 	return;
 
     /*
@@ -1687,7 +1687,7 @@ sc_cnungrab(struct consdev *cp)
     if (scp->sc->kbd == NULL)
 	return;
 
-    if (--scp->grabbed > 0)
+    if (--scp->sc->grab_level > 0)
 	return;
 
     kbdd_poll(scp->sc->kbd, FALSE);

Modified: stable/11/sys/dev/syscons/syscons.h
==============================================================================
--- stable/11/sys/dev/syscons/syscons.h	Tue Mar 13 09:42:33 2018	(r330835)
+++ stable/11/sys/dev/syscons/syscons.h	Tue Mar 13 09:46:09 2018	(r330836)
@@ -230,6 +230,7 @@ typedef struct sc_softc {
 	char        	switch_in_progress;
 	char        	write_in_progress;
 	char        	blink_in_progress;
+	int		grab_level;
 	struct mtx	scr_lock;		/* mutex for sc_puts() */
 	struct mtx	video_mtx;
 
@@ -304,7 +305,6 @@ typedef struct scr_stat {
 	void		*ts;
 
 	int	 	status;			/* status (bitfield) */
-	int		grabbed;
 	int		kbd_mode;		/* keyboard I/O mode */
 	int		kbd_prev_mode;		/* keyboard I/O mode */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803130946.w2D9k9sN004152>