FreeBSD/sys/dev/vt/vt_core.c
/* Switch window ignoring process locking. */
Switch window ignoring process locking.
Switch window ignoring process locking .
static int
vt_window_switch(struct vt_window *vw)
{
	struct vt_device *vd = vw->vw_device;
	struct vt_window *curvw = vd->vd_curwindow;
	keyboard_t *kbd;
	VT_LOCK(vd);
	if (curvw == vw) {
		VT_UNLOCK(vd);
		return (0);
	}
	if (!(vw->vw_flags & (VWF_OPENED|VWF_CONSOLE))) {
		VT_UNLOCK(vd);
		return (EINVAL);
	}
	vt_suspend_flush_timer(vd);
	vd->vd_curwindow = vw;
	vd->vd_flags |= VDF_INVALID;
	cv_broadcast(&vd->vd_winswitch);
	VT_UNLOCK(vd);
	if (vd->vd_driver->vd_postswitch)
		vd->vd_driver->vd_postswitch(vd);
	vt_resume_flush_timer(vd, 0);
	mtx_lock(&Giant);
	kbd = kbd_get_keyboard(vd->vd_keyboard);
	if (kbd != NULL) {
		if (curvw->vw_kbdmode == K_XLATE)
			vt_save_kbd_state(curvw, kbd);
		vt_update_kbd_mode(vw, kbd);
		vt_update_kbd_state(vw, kbd);
	}
	mtx_unlock(&Giant);
	DPRINTF(10, "%s(ttyv%d) done\n", __func__, vw->vw_number);
	return (0);
}
static int vt_window_switch ( struct vt_window * vw ) { struct vt_device * vd = vw -> vw_device ; struct vt_window * curvw = vd -> vd_curwindow ; keyboard_t * kbd ; VT_LOCK ( vd ) ; if ( curvw == vw ) { VT_UNLOCK ( vd ) ; return ( 0 ) ; } if ( ! ( vw -> vw_flags & ( VWF_OPENED | VWF_CONSOLE ) ) ) { VT_UNLOCK ( vd ) ; return ( EINVAL ) ; } vt_suspend_flush_timer ( vd ) ; vd -> vd_curwindow = vw ; vd -> vd_flags |= VDF_INVALID ; cv_broadcast ( & vd -> vd_winswitch ) ; VT_UNLOCK ( vd ) ; if ( vd -> vd_driver -> vd_postswitch ) vd -> vd_driver -> vd_postswitch ( vd ) ; vt_resume_flush_timer ( vd , 0 ) ; mtx_lock ( & Giant ) ; kbd = kbd_get_keyboard ( vd -> vd_keyboard ) ; if ( kbd != NULL ) { if ( curvw -> vw_kbdmode == K_XLATE ) vt_save_kbd_state ( curvw , kbd ) ; vt_update_kbd_mode ( vw , kbd ) ; vt_update_kbd_state ( vw , kbd ) ; } mtx_unlock ( & Giant ) ; DPRINTF ( 10 , " \n " , __func__ , vw -> vw_number ) ; return ( 0 ) ; }
Switch window ignoring process locking.
Switch window ignoring process locking .
/* Nothing to do. */ /* Restore per-window keyboard mode. */