public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kurt Garloff <garloff@suse.de>
To: Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Andries Brouwer <Andries.Brouwer@cwi.nl>
Cc: Linux kernel list <linux-kernel@vger.kernel.org>
Subject: vt.c: unimap changes to (fg_?)console
Date: Mon, 7 May 2001 12:37:09 +0200	[thread overview]
Message-ID: <20010507123709.D8052@garloff.suse.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1499 bytes --]

Hi Linus, Alan, Andries,

if you open /dev/tty4 and change the font via ioctl(KDFONTOP), it will be
applied to the opened console, i.e. tty4. Then you set the corresponding
unicodemap via PIO_UNIMAPCLR and PIO_UNIMAP ioctls. Those get applied to the
current foreground console. Which is inconsistent.

Looking at vt.c: vt_ioctl(), the situation is a bit messy: Some ioctls don't
explicitly specify a tty (probably not needed, as some settings are global),
some apply to fg_console, some apply to the opened console which is
((struct vt_struct*)tty->driver_data)->vc_num.

I would appreciate, if somebody with more knowledge could have a look and
check whether this is all correct. At least for the above case, it's not.
(Andries, I would appreciate if you have a look; you understand much more of
it than I do.)

I attach a patch to fix the specific problem reported above. It applies to
both 2.4.4 and 2.2.19. ioctl(PIO_UNIMAP[CLR]) is applied to the opened
console now instead of fg_console.
Please apply until somebody comes with a complete vt.c cleanup!

If you want to test yourself: I also have a patch against kbd-1.05
which allows you to use setfont -c /dev/ttyXX to specify which terminal you
want to. I already sent it to Andries.

Regards,
-- 
Kurt Garloff  <garloff@suse.de>                          Eindhoven, NL
GPG key: See mail header, key servers         Linux kernel development
SuSE GmbH, Nuernberg, FRG                               SCSI, Security

[-- Attachment #1.2: unimap_set-244.diff --]
[-- Type: text/plain, Size: 1330 bytes --]

--- linux-244.compile/drivers/char/vt.c.orig	Fri Feb  9 20:30:22 2001
+++ linux-244.compile/drivers/char/vt.c	Mon May  7 10:37:25 2001
@@ -392,7 +392,7 @@
 }
 
 static inline int 
-do_unimap_ioctl(int cmd, struct unimapdesc *user_ud,int perm)
+do_unimap_ioctl(int cmd, struct unimapdesc *user_ud, int perm, unsigned int console)
 {
 	struct unimapdesc tmp;
 	int i = 0; 
@@ -408,9 +408,11 @@
 	case PIO_UNIMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_unimap(fg_console, tmp.entry_ct, tmp.entries);
+		return con_set_unimap(console, tmp.entry_ct, tmp.entries);
 	case GIO_UNIMAP:
-		return con_get_unimap(fg_console, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
+		if (!perm && fg_console != console)
+			return -EPERM;
+		return con_get_unimap(console, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
 	}
 	return 0;
 }
@@ -1029,13 +1031,13 @@
 			return -EPERM;
 		i = copy_from_user(&ui, (void *)arg, sizeof(struct unimapinit));
 		if (i) return -EFAULT;
-		con_clear_unimap(fg_console, &ui);
+		con_clear_unimap(console, &ui);
 		return 0;
 	      }
 
 	case PIO_UNIMAP:
 	case GIO_UNIMAP:
-		return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm);
+		return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm, console);
 
 	case VT_LOCKSWITCH:
 		if (!suser())

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

             reply	other threads:[~2001-05-07 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-07 10:37 Kurt Garloff [this message]
2001-05-07 13:45 ` vt.c: unimap changes to (fg_?)console H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010507123709.D8052@garloff.suse.de \
    --to=garloff@suse.de \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox