mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Restrict VT-Switching per VT
@ 2001-05-05 18:09 Thomas Warwaris
  0 siblings, 0 replies; only message in thread
From: Thomas Warwaris @ 2001-05-05 18:09 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-05 18:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-05 18:09 [PATCH] Restrict VT-Switching per VT Thomas Warwaris

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®