diff options
author | Alan Cox <alan@linux.intel.com> | 2009-09-19 16:13:26 -0400 |
---|---|---|
committer | Live-CD User <linux@linux.site> | 2009-09-19 16:13:26 -0400 |
commit | d3b5cffcf84a8bdc7073dce4745d67c72629af85 (patch) | |
tree | dfcaa9dbc59b3f17160624803f54711db1d9786f /drivers/char/vt_ioctl.c | |
parent | a5eb56242d1e2d82938a066219ac1cdf0d68adc8 (diff) |
vt: add an activate and lock
X and other graphical interfaces need to be able to flip to a console
and lock it into graphics mode without races.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/vt_ioctl.c')
-rw-r--r-- | drivers/char/vt_ioctl.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index d29fbd44bdca..0fceb8f4d6f2 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -972,6 +972,41 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
972 | } | 972 | } |
973 | break; | 973 | break; |
974 | 974 | ||
975 | case VT_SETACTIVATE: | ||
976 | { | ||
977 | struct vt_setactivate vsa; | ||
978 | |||
979 | if (!perm) | ||
980 | goto eperm; | ||
981 | |||
982 | if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg, | ||
983 | sizeof(struct vt_setactivate))) | ||
984 | return -EFAULT; | ||
985 | if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) | ||
986 | ret = -ENXIO; | ||
987 | else { | ||
988 | vsa.console--; | ||
989 | acquire_console_sem(); | ||
990 | ret = vc_allocate(vsa.console); | ||
991 | if (ret == 0) { | ||
992 | struct vc_data *nvc; | ||
993 | /* This is safe providing we don't drop the | ||
994 | console sem between vc_allocate and | ||
995 | finishing referencing nvc */ | ||
996 | nvc = vc_cons[vsa.console].d; | ||
997 | nvc->vt_mode = vsa.mode; | ||
998 | nvc->vt_mode.frsig = 0; | ||
999 | put_pid(nvc->vt_pid); | ||
1000 | nvc->vt_pid = get_pid(task_pid(current)); | ||
1001 | } | ||
1002 | release_console_sem(); | ||
1003 | if (ret) | ||
1004 | break; | ||
1005 | /* Commence switch and lock */ | ||
1006 | set_console(arg); | ||
1007 | } | ||
1008 | } | ||
1009 | |||
975 | /* | 1010 | /* |
976 | * wait until the specified VT has been activated | 1011 | * wait until the specified VT has been activated |
977 | */ | 1012 | */ |
@@ -1342,7 +1377,8 @@ void vc_SAK(struct work_struct *work) | |||
1342 | } | 1377 | } |
1343 | 1378 | ||
1344 | /* | 1379 | /* |
1345 | * Performs the back end of a vt switch | 1380 | * Performs the back end of a vt switch. Called under the console |
1381 | * semaphore. | ||
1346 | */ | 1382 | */ |
1347 | static void complete_change_console(struct vc_data *vc) | 1383 | static void complete_change_console(struct vc_data *vc) |
1348 | { | 1384 | { |