Deleted Added
full compact
vt_core.c (257722) vt_core.c (257815)
1/*-
2 * Copyright (c) 2009, 2013 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Ed Schouten under sponsorship from the
6 * FreeBSD Foundation.
7 *
8 * Portions of this software were developed by Oleksandr Rybalko

--- 17 unchanged lines hidden (view full) ---

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009, 2013 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Ed Schouten under sponsorship from the
6 * FreeBSD Foundation.
7 *
8 * Portions of this software were developed by Oleksandr Rybalko

--- 17 unchanged lines hidden (view full) ---

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: user/ed/newcons/sys/dev/vt/vt_core.c 257722 2013-11-05 22:57:05Z ray $");
34__FBSDID("$FreeBSD: user/ed/newcons/sys/dev/vt/vt_core.c 257815 2013-11-07 21:08:52Z ray $");
35
36#include <sys/param.h>
37#include <sys/consio.h>
38#include <sys/eventhandler.h>
39#include <sys/fbio.h>
40#include <sys/kbio.h>
41#include <sys/kdb.h>
42#include <sys/kernel.h>

--- 929 unchanged lines hidden (view full) ---

972 vw->vw_pid = 0;
973 }
974 return FALSE;
975}
976
977static int
978signal_vt_rel(struct vt_window *vw)
979{
35
36#include <sys/param.h>
37#include <sys/consio.h>
38#include <sys/eventhandler.h>
39#include <sys/fbio.h>
40#include <sys/kbio.h>
41#include <sys/kdb.h>
42#include <sys/kernel.h>

--- 929 unchanged lines hidden (view full) ---

972 vw->vw_pid = 0;
973 }
974 return FALSE;
975}
976
977static int
978signal_vt_rel(struct vt_window *vw)
979{
980
980 if (vw->vw_smode.mode != VT_PROCESS)
981 return FALSE;
982 if (vw->vw_proc == NULL || vt_proc_alive(vw) == FALSE) {
983 vw->vw_proc = NULL;
984 vw->vw_pid = 0;
985 return TRUE;
986 }
987 vw->vw_flags |= VWF_SWWAIT_REL;
988 PROC_LOCK(vw->vw_proc);
989 kern_psignal(vw->vw_proc, vw->vw_smode.relsig);
990 PROC_UNLOCK(vw->vw_proc);
991 DPRINTF(1, "sending relsig to %d\n", vw->vw_pid);
992 return TRUE;
993}
994
995static int
996signal_vt_acq(struct vt_window *vw)
997{
981 if (vw->vw_smode.mode != VT_PROCESS)
982 return FALSE;
983 if (vw->vw_proc == NULL || vt_proc_alive(vw) == FALSE) {
984 vw->vw_proc = NULL;
985 vw->vw_pid = 0;
986 return TRUE;
987 }
988 vw->vw_flags |= VWF_SWWAIT_REL;
989 PROC_LOCK(vw->vw_proc);
990 kern_psignal(vw->vw_proc, vw->vw_smode.relsig);
991 PROC_UNLOCK(vw->vw_proc);
992 DPRINTF(1, "sending relsig to %d\n", vw->vw_pid);
993 return TRUE;
994}
995
996static int
997signal_vt_acq(struct vt_window *vw)
998{
999
998 if (vw->vw_smode.mode != VT_PROCESS)
999 return FALSE;
1000 if (vw == vw->vw_device->vd_windows[VT_CONSWINDOW])
1001 cnavailable(vw->vw_terminal->consdev, FALSE);
1002 if (vw->vw_proc == NULL || vt_proc_alive(vw) == FALSE) {
1003 vw->vw_proc = NULL;
1004 vw->vw_pid = 0;
1005 return TRUE;

--- 4 unchanged lines hidden (view full) ---

1010 PROC_UNLOCK(vw->vw_proc);
1011 DPRINTF(1, "sending acqsig to %d\n", vw->vw_pid);
1012 return TRUE;
1013}
1014
1015static int
1016finish_vt_rel(struct vt_window *vw, int release, int *s)
1017{
1000 if (vw->vw_smode.mode != VT_PROCESS)
1001 return FALSE;
1002 if (vw == vw->vw_device->vd_windows[VT_CONSWINDOW])
1003 cnavailable(vw->vw_terminal->consdev, FALSE);
1004 if (vw->vw_proc == NULL || vt_proc_alive(vw) == FALSE) {
1005 vw->vw_proc = NULL;
1006 vw->vw_pid = 0;
1007 return TRUE;

--- 4 unchanged lines hidden (view full) ---

1012 PROC_UNLOCK(vw->vw_proc);
1013 DPRINTF(1, "sending acqsig to %d\n", vw->vw_pid);
1014 return TRUE;
1015}
1016
1017static int
1018finish_vt_rel(struct vt_window *vw, int release, int *s)
1019{
1020
1018 if (vw->vw_flags & VWF_SWWAIT_REL) {
1019 vw->vw_flags &= ~VWF_SWWAIT_REL;
1020 if (release) {
1021 callout_drain(&vw->vw_proc_dead_timer);
1022 vt_late_window_switch(vw->vw_switch_to);
1023 }
1024 return 0;
1025 }
1026 return EINVAL;
1027}
1028
1029static int
1030finish_vt_acq(struct vt_window *vw)
1031{
1021 if (vw->vw_flags & VWF_SWWAIT_REL) {
1022 vw->vw_flags &= ~VWF_SWWAIT_REL;
1023 if (release) {
1024 callout_drain(&vw->vw_proc_dead_timer);
1025 vt_late_window_switch(vw->vw_switch_to);
1026 }
1027 return 0;
1028 }
1029 return EINVAL;
1030}
1031
1032static int
1033finish_vt_acq(struct vt_window *vw)
1034{
1035
1032 if (vw->vw_flags & VWF_SWWAIT_ACQ) {
1033 vw->vw_flags &= ~VWF_SWWAIT_ACQ;
1034 return 0;
1035 }
1036 return EINVAL;
1037}
1038
1039static int

--- 418 unchanged lines hidden (view full) ---

1458 callout_schedule(&vd->vd_timer, hz / VT_TIMERFREQ);
1459
1460 termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal);
1461
1462 /* Update console window sizes to actual. */
1463 vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz);
1464 terminal_set_winsize(vd->vd_windows[VT_CONSWINDOW]->vw_terminal, &wsz);
1465}
1036 if (vw->vw_flags & VWF_SWWAIT_ACQ) {
1037 vw->vw_flags &= ~VWF_SWWAIT_ACQ;
1038 return 0;
1039 }
1040 return EINVAL;
1041}
1042
1043static int

--- 418 unchanged lines hidden (view full) ---

1462 callout_schedule(&vd->vd_timer, hz / VT_TIMERFREQ);
1463
1464 termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal);
1465
1466 /* Update console window sizes to actual. */
1467 vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz);
1468 terminal_set_winsize(vd->vd_windows[VT_CONSWINDOW]->vw_terminal, &wsz);
1469}
1470
1471void
1472vt_suspend()
1473{
1474
1475 /* Save current window. */
1476 main_vd->vd_savedwindow = main_vd->vd_curwindow;
1477 /* Ask holding process to free window and switch to console window */
1478 vt_proc_window_switch(main_vd->vd_windows[VT_CONSWINDOW]);
1479}
1480
1481void
1482vt_resume()
1483{
1484
1485 /* Switch back to saved window */
1486 if (main_vd->vd_savedwindow != NULL)
1487 vt_proc_window_switch(main_vd->vd_savedwindow);
1488 main_vd->vd_savedwindow = NULL;
1489}