Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/vt/vt_core.c
Show First 20 Lines • Show All 445 Lines • ▼ Show 20 Lines | |||||
/* Switch window. */ | /* Switch window. */ | ||||
static int | static int | ||||
vt_proc_window_switch(struct vt_window *vw) | vt_proc_window_switch(struct vt_window *vw) | ||||
{ | { | ||||
struct vt_window *curvw; | struct vt_window *curvw; | ||||
struct vt_device *vd; | struct vt_device *vd; | ||||
int ret; | int ret; | ||||
/* Prevent switching to NULL */ | |||||
if (vw == NULL) { | |||||
DPRINTF(30, "%s: Cannot switch to NULL.", __func__); | |||||
ngie: Is there a better debug message that can be provided for this and the item below, e.g. "Cannot… | |||||
hselaskyAuthorUnsubmitted Not Done Inline ActionsI'll update it. hselasky: I'll update it. | |||||
return (EINVAL); | |||||
} | |||||
vd = vw->vw_device; | vd = vw->vw_device; | ||||
curvw = vd->vd_curwindow; | curvw = vd->vd_curwindow; | ||||
/* | |||||
* Prevent switching to self to avoid starting the | |||||
* "vt_switch_timer()" again: | |||||
*/ | |||||
if (vw == curvw) { | |||||
DPRINTF(30, "%s: Cannot switch to self.", __func__); | |||||
return (0); | |||||
ngieUnsubmitted Not Done Inline ActionsIs there a reason why this is returning 0 and the previous error condition is returning EINVAL? ngie: Is there a reason why this is returning 0 and the previous error condition is returning EINVAL? | |||||
hselaskyAuthorUnsubmitted Not Done Inline ActionsIt is not a bug to switch the terminal to the same index like before. hselasky: It is not a bug to switch the terminal to the same index like before. | |||||
} | |||||
if (curvw->vw_flags & VWF_VTYLOCK) | if (curvw->vw_flags & VWF_VTYLOCK) | ||||
return (EBUSY); | return (EBUSY); | ||||
/* Ask current process permission to switch away. */ | /* Ask current process permission to switch away. */ | ||||
if (curvw->vw_smode.mode == VT_PROCESS) { | if (curvw->vw_smode.mode == VT_PROCESS) { | ||||
DPRINTF(30, "%s: VT_PROCESS ", __func__); | DPRINTF(30, "%s: VT_PROCESS ", __func__); | ||||
if (vt_proc_alive(curvw) == FALSE) { | if (vt_proc_alive(curvw) == FALSE) { | ||||
DPRINTF(30, "Dead. Cleaning."); | DPRINTF(30, "Dead. Cleaning."); | ||||
▲ Show 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | vt_scrollmode_kbdevent(struct vt_window *vw, int c, int console) | ||||
if ((c & SPCLKEY) == 0) | if ((c & SPCLKEY) == 0) | ||||
return; | return; | ||||
c &= ~SPCLKEY; | c &= ~SPCLKEY; | ||||
if (console == 0) { | if (console == 0) { | ||||
if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { | if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { | ||||
vw = vd->vd_windows[c - F_SCR]; | vw = vd->vd_windows[c - F_SCR]; | ||||
if (vw != NULL) | |||||
vt_proc_window_switch(vw); | vt_proc_window_switch(vw); | ||||
return; | return; | ||||
} | } | ||||
VT_LOCK(vd); | VT_LOCK(vd); | ||||
} | } | ||||
switch (c) { | switch (c) { | ||||
case SLK: { | case SLK: { | ||||
/* Turn scrolling off. */ | /* Turn scrolling off. */ | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if (vw->vw_flags & VWF_SCROLL) { | ||||
return (0); | return (0); | ||||
} | } | ||||
if (c & SPCLKEY) { | if (c & SPCLKEY) { | ||||
c &= ~SPCLKEY; | c &= ~SPCLKEY; | ||||
if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { | if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { | ||||
vw = vd->vd_windows[c - F_SCR]; | vw = vd->vd_windows[c - F_SCR]; | ||||
if (vw != NULL) | |||||
vt_proc_window_switch(vw); | vt_proc_window_switch(vw); | ||||
return (0); | return (0); | ||||
} | } | ||||
switch (c) { | switch (c) { | ||||
case NEXT: | case NEXT: | ||||
/* Switch to next VT. */ | /* Switch to next VT. */ | ||||
c = (vw->vw_number + 1) % VT_MAXWINDOWS; | c = (vw->vw_number + 1) % VT_MAXWINDOWS; | ||||
vw = vd->vd_windows[c]; | vw = vd->vd_windows[c]; | ||||
if (vw != NULL) | |||||
vt_proc_window_switch(vw); | vt_proc_window_switch(vw); | ||||
return (0); | return (0); | ||||
case PREV: | case PREV: | ||||
/* Switch to previous VT. */ | /* Switch to previous VT. */ | ||||
c = (vw->vw_number - 1) % VT_MAXWINDOWS; | c = (vw->vw_number - 1) % VT_MAXWINDOWS; | ||||
vw = vd->vd_windows[c]; | vw = vd->vd_windows[c]; | ||||
if (vw != NULL) | |||||
vt_proc_window_switch(vw); | vt_proc_window_switch(vw); | ||||
return (0); | return (0); | ||||
case SLK: { | case SLK: { | ||||
vt_save_kbd_state(vw, kbd); | vt_save_kbd_state(vw, kbd); | ||||
VT_LOCK(vd); | VT_LOCK(vd); | ||||
if (vw->vw_kbdstate & SLKED) { | if (vw->vw_kbdstate & SLKED) { | ||||
/* Turn scrolling on. */ | /* Turn scrolling on. */ | ||||
vw->vw_flags |= VWF_SCROLL; | vw->vw_flags |= VWF_SCROLL; | ||||
VTBUF_SLCK_ENABLE(&vw->vw_buf); | VTBUF_SLCK_ENABLE(&vw->vw_buf); | ||||
▲ Show 20 Lines • Show All 2,002 Lines • Show Last 20 Lines |
Is there a better debug message that can be provided for this and the item below, e.g. "Cannot switch vw (is NULL)", etc (otherwise I can't distinguish this error from the other, can I)?.