Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "tty: Add a new VT mode which is like VT_PROCESS but doesn't require a VT_RELDISP ioctl call"

This reverts commit eec9fe7d1ab4a0dfac4cb43047a7657fffd0002f.

Ari writes as the reason this should be reverted:
The problems with this patch include:
1. There's at least one subtlety I overlooked - switching
between X servers (i.e. from one X VT to another) still requires
the cooperation of both X servers. I was assuming that KMS
eliminated this.
2. It hasn't been tested at all (no X server patch exists which
uses the new mode).

As he was the original author of the patch, I'll revert it.

Cc: Ari Entlich <atrigent@ccs.neu.edu>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+20 -22
+19 -20
drivers/char/vt_ioctl.c
··· 888 888 ret = -EFAULT; 889 889 goto out; 890 890 } 891 - if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS && tmp.mode != VT_PROCESS_AUTO) { 891 + if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) { 892 892 ret = -EINVAL; 893 893 goto out; 894 894 } ··· 1622 1622 * telling it that it has acquired. Also check if it has died and 1623 1623 * clean up (similar to logic employed in change_console()) 1624 1624 */ 1625 - if (vc->vt_mode.mode == VT_PROCESS || vc->vt_mode.mode == VT_PROCESS_AUTO) { 1625 + if (vc->vt_mode.mode == VT_PROCESS) { 1626 1626 /* 1627 1627 * Send the signal as privileged - kill_pid() will 1628 1628 * tell us if the process has gone or something else ··· 1682 1682 * vt to auto control. 1683 1683 */ 1684 1684 vc = vc_cons[fg_console].d; 1685 - if (vc->vt_mode.mode == VT_PROCESS || vc->vt_mode.mode == VT_PROCESS_AUTO) { 1685 + if (vc->vt_mode.mode == VT_PROCESS) { 1686 1686 /* 1687 1687 * Send the signal as privileged - kill_pid() will 1688 1688 * tell us if the process has gone or something else ··· 1693 1693 */ 1694 1694 vc->vt_newvt = new_vc->vc_num; 1695 1695 if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) { 1696 - if(vc->vt_mode.mode == VT_PROCESS) 1697 - /* 1698 - * It worked. Mark the vt to switch to and 1699 - * return. The process needs to send us a 1700 - * VT_RELDISP ioctl to complete the switch. 1701 - */ 1702 - return; 1703 - } else { 1704 1696 /* 1705 - * The controlling process has died, so we revert back to 1706 - * normal operation. In this case, we'll also change back 1707 - * to KD_TEXT mode. I'm not sure if this is strictly correct 1708 - * but it saves the agony when the X server dies and the screen 1709 - * remains blanked due to KD_GRAPHICS! It would be nice to do 1710 - * this outside of VT_PROCESS but there is no single process 1711 - * to account for and tracking tty count may be undesirable. 1697 + * It worked. Mark the vt to switch to and 1698 + * return. The process needs to send us a 1699 + * VT_RELDISP ioctl to complete the switch. 1712 1700 */ 1713 - reset_vc(vc); 1701 + return; 1714 1702 } 1715 1703 1716 1704 /* 1717 - * Fall through to normal (VT_AUTO and VT_PROCESS_AUTO) handling of the switch... 1705 + * The controlling process has died, so we revert back to 1706 + * normal operation. In this case, we'll also change back 1707 + * to KD_TEXT mode. I'm not sure if this is strictly correct 1708 + * but it saves the agony when the X server dies and the screen 1709 + * remains blanked due to KD_GRAPHICS! It would be nice to do 1710 + * this outside of VT_PROCESS but there is no single process 1711 + * to account for and tracking tty count may be undesirable. 1712 + */ 1713 + reset_vc(vc); 1714 + 1715 + /* 1716 + * Fall through to normal (VT_AUTO) handling of the switch... 1718 1717 */ 1719 1718 } 1720 1719
+1 -2
include/linux/vt.h
··· 27 27 #define VT_SETMODE 0x5602 /* set mode of active vt */ 28 28 #define VT_AUTO 0x00 /* auto vt switching */ 29 29 #define VT_PROCESS 0x01 /* process controls switching */ 30 - #define VT_PROCESS_AUTO 0x02 /* process is notified of switching */ 30 + #define VT_ACKACQ 0x02 /* acknowledge switch */ 31 31 32 32 struct vt_stat { 33 33 unsigned short v_active; /* active vt */ ··· 38 38 #define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ 39 39 40 40 #define VT_RELDISP 0x5605 /* release display */ 41 - #define VT_ACKACQ 0x02 /* acknowledge switch */ 42 41 43 42 #define VT_ACTIVATE 0x5606 /* make vt active */ 44 43 #define VT_WAITACTIVE 0x5607 /* wait for vt active */