2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #ifdef HAVE_XORG_CONFIG_H
25 #include <xorg-config.h>
32 #include "xf86_OSlib.h"
35 #include <sys/vtdaemon.h>
38 * Handle the VT-switching interface for Solaris/OpenSolaris
41 static int xf86VTPruneDoor
= 0;
44 xf86VTRelease(int sig
)
46 if (xf86Info
.vtPendingNum
== -1) {
48 xf86Info
.vtRequestsPending
= TRUE
;
52 ioctl(xf86Info
.consoleFd
, VT_RELDISP
, 1);
53 xf86Info
.vtPendingNum
= -1;
59 xf86VTAcquire(int sig
)
61 xf86Info
.vtRequestsPending
= TRUE
;
66 xf86VTSwitchPending(void)
68 return xf86Info
.vtRequestsPending
? TRUE
: FALSE
;
72 xf86VTSwitchAway(void)
75 vt_cmd_arg_t vt_door_arg
;
78 xf86Info
.vtRequestsPending
= FALSE
;
80 if (xf86VTPruneDoor
) {
82 ioctl(xf86Info
.consoleFd
, VT_RELDISP
, 1);
86 vt_door_arg
.vt_ev
= VT_EV_HOTKEYS
;
87 vt_door_arg
.vt_num
= xf86Info
.vtPendingNum
;
88 door_arg
.data_ptr
= (char *) &vt_door_arg
;
89 door_arg
.data_size
= sizeof(vt_cmd_arg_t
);
92 door_arg
.desc_ptr
= NULL
;
93 door_arg
.desc_num
= 0;
95 if ((door_fd
= open(VT_DAEMON_DOOR_FILE
, O_RDONLY
)) < 0)
98 if (door_call(door_fd
, &door_arg
) != 0) {
110 xf86Info
.vtRequestsPending
= FALSE
;
111 if (ioctl(xf86Info
.consoleFd
, VT_RELDISP
, VT_ACKACQ
) < 0) {
120 xf86VTActivate(int vtno
)
122 struct vt_stat state
;
124 if (ioctl(xf86Info
.consoleFd
, VT_GETSTATE
, &state
) < 0)
127 if ((state
.v_state
& (1 << vtno
)) == 0)
130 xf86Info
.vtRequestsPending
= TRUE
;
131 xf86Info
.vtPendingNum
= vtno
;