Loading drivers/tty/vt/vt_ioctl.c +40 −48 Original line number Diff line number Diff line Loading @@ -633,6 +633,42 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, return 0; } static int vt_reldisp(struct vc_data *vc, unsigned int swtch) { int newvt, ret; if (vc->vt_mode.mode != VT_PROCESS) return -EINVAL; /* Switched-to response */ if (vc->vt_newvt < 0) { /* If it's just an ACK, ignore it */ return swtch == VT_ACKACQ ? 0 : -EINVAL; } /* Switching-from response */ if (swtch == 0) { /* Switch disallowed, so forget we were trying to do it. */ vc->vt_newvt = -1; return 0; } /* The current vt has been released, so complete the switch. */ newvt = vc->vt_newvt; vc->vt_newvt = -1; ret = vc_allocate(newvt); if (ret) return ret; /* * When we actually do the console switch, make sure we are atomic with * respect to other console switches.. */ complete_change_console(vc_cons[newvt].d); return 0; } static int vt_setactivate(struct vt_setactivate __user *sa) { struct vt_setactivate vsa; Loading Loading @@ -865,55 +901,11 @@ int vt_ioctl(struct tty_struct *tty, return -EPERM; console_lock(); if (vc->vt_mode.mode != VT_PROCESS) { ret = vt_reldisp(vc, arg); console_unlock(); return -EINVAL; } /* * Switching-from response */ if (vc->vt_newvt >= 0) { if (arg == 0) /* * Switch disallowed, so forget we were trying * to do it. */ vc->vt_newvt = -1; else { /* * The current vt has been released, so * complete the switch. */ int newvt; newvt = vc->vt_newvt; vc->vt_newvt = -1; ret = vc_allocate(newvt); if (ret) { console_unlock(); return ret; } /* * When we actually do the console switch, * make sure we are atomic with respect to * other console switches.. */ complete_change_console(vc_cons[newvt].d); } } else { /* * Switched-to response */ /* * If it's just an ACK, ignore it */ if (arg != VT_ACKACQ) { console_unlock(); return -EINVAL; } } console_unlock(); break; /* * Disallocate memory associated to VT (but leave VT1) Loading Loading
drivers/tty/vt/vt_ioctl.c +40 −48 Original line number Diff line number Diff line Loading @@ -633,6 +633,42 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, return 0; } static int vt_reldisp(struct vc_data *vc, unsigned int swtch) { int newvt, ret; if (vc->vt_mode.mode != VT_PROCESS) return -EINVAL; /* Switched-to response */ if (vc->vt_newvt < 0) { /* If it's just an ACK, ignore it */ return swtch == VT_ACKACQ ? 0 : -EINVAL; } /* Switching-from response */ if (swtch == 0) { /* Switch disallowed, so forget we were trying to do it. */ vc->vt_newvt = -1; return 0; } /* The current vt has been released, so complete the switch. */ newvt = vc->vt_newvt; vc->vt_newvt = -1; ret = vc_allocate(newvt); if (ret) return ret; /* * When we actually do the console switch, make sure we are atomic with * respect to other console switches.. */ complete_change_console(vc_cons[newvt].d); return 0; } static int vt_setactivate(struct vt_setactivate __user *sa) { struct vt_setactivate vsa; Loading Loading @@ -865,55 +901,11 @@ int vt_ioctl(struct tty_struct *tty, return -EPERM; console_lock(); if (vc->vt_mode.mode != VT_PROCESS) { ret = vt_reldisp(vc, arg); console_unlock(); return -EINVAL; } /* * Switching-from response */ if (vc->vt_newvt >= 0) { if (arg == 0) /* * Switch disallowed, so forget we were trying * to do it. */ vc->vt_newvt = -1; else { /* * The current vt has been released, so * complete the switch. */ int newvt; newvt = vc->vt_newvt; vc->vt_newvt = -1; ret = vc_allocate(newvt); if (ret) { console_unlock(); return ret; } /* * When we actually do the console switch, * make sure we are atomic with respect to * other console switches.. */ complete_change_console(vc_cons[newvt].d); } } else { /* * Switched-to response */ /* * If it's just an ACK, ignore it */ if (arg != VT_ACKACQ) { console_unlock(); return -EINVAL; } } console_unlock(); break; /* * Disallocate memory associated to VT (but leave VT1) Loading