mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Warwaris <war@tcp-ip.at>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Restrict VT-Switching per VT
Date: Sat, 05 May 2001 20:09:06 +0200	[thread overview]
Message-ID: <3AF441C2.1E3A4D9C@tcp-ip.at> (raw)

Linus,

this patch on 2.4.4 adds the ability to turn VT-switching
on and off for each (existing) VT via ioctl().

It works exactly like the existing code by blocking
VT-switching to the blocked terminals.

It is a very nice feature to 'hide' VT's of users
allowing others to work with other VT's on the same
machine.

I am not on the kernel list. Pleas CC me followups
to war@tcp-ip.at

BTW: Thank you all for your work.

Thomas

diff -urN -X dontdiff linux-2.4.4.ori/include/linux/vt.h linux/include/linux/vt.h
--- linux-2.4.4.ori/include/linux/vt.h	Sat May  5 20:46:51 2001
+++ linux/include/linux/vt.h	Sat May  5 21:33:26 2001
@@ -50,5 +50,7 @@
 #define VT_RESIZEX      0x560A  /* set kernel's idea of screensize + more */
 #define VT_LOCKSWITCH   0x560B  /* disallow vt switching */
 #define VT_UNLOCKSWITCH 0x560C  /* allow vt switching */
+#define VT_LOCKSWITCHTO 	0x560D  /* disallow vt switching to a vt*/
+#define VT_UNLOCKSWITCHTO 	0x560E  /* allow vt switching to a vt*/
 
 #endif /* _LINUX_VT_H */
diff -urN -X dontdiff linux-2.4.4.ori/drivers/char/vt.c linux/drivers/char/vt.c
--- linux-2.4.4.ori/drivers/char/vt.c	Fri Feb  9 20:30:22 2001
+++ linux/drivers/char/vt.c	Sat May  5 21:33:44 2001
@@ -7,6 +7,7 @@
  *  Dynamic keymap and string allocation - aeb@cwi.nl - May 1994
  *  Restrict VT switching via ioctl() - grif@cs.ucr.edu - Dec 1995
  *  Some code moved for less code duplication - Andi Kleen - Mar 1997
+ *  Restrict VT switching per VT - Thomas Warwaris - May 2001
  */
 
 #include <linux/config.h>
@@ -41,6 +42,7 @@
 #endif /* CONFIG_FB_COMPAT_XPMAC */
 
 char vt_dont_switch;
+char vt_dont_switch_to [MAX_NR_CONSOLES];
 extern struct tty_driver console_driver;
 
 #define VT_IS_IN_USE(i)	(console_driver.table[i] && console_driver.table[i]->count)
@@ -1047,6 +1049,16 @@
 		   return -EPERM;
 		vt_dont_switch = 0;
 		return 0;
+	case VT_LOCKSWITCHTO:
+		if (!suser())
+			return -EPERM;
+		vt_dont_switch_to[arg-1] = 1;
+		return 0;
+	case VT_UNLOCKSWITCHTO:
+		if (!suser())
+			return -EPERM;
+		vt_dont_switch_to[arg-1] = 0;
+		return 0;
 #ifdef CONFIG_FB_COMPAT_XPMAC
 	case VC_GETMODE:
 		{
@@ -1243,6 +1255,8 @@
 void change_console(unsigned int new_console)
 {
         if ((new_console == fg_console) || (vt_dont_switch))
+                return;
+        if ( vt_dont_switch_to[new_console] )
                 return;
         if (!vc_cons_allocated(new_console))
 		return;

                 reply	other threads:[~2001-05-05 18:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3AF441C2.1E3A4D9C@tcp-ip.at \
    --to=war@tcp-ip.at \
    --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

all inboxes | Powered by JetHome®