1vt(7I) Ioctl Requests vt(7I)
2
3
4
6 vt - Solaris virtual console interface
7
9 #include <sys/kd.h>
10
11
12 #include <sys/vt.h>
13
14
16 The virtual console device driver — also known as virtual terminal (VT)
17 — is a layer of management functions that provides facilities to sup‐
18 port and switch between multiple screen faces on a single physical
19 device.
20
21
22 VT's are accessed in the same way as other devices. The open(2) system
23 call is used to open the virtual console and read(2), write(2) and
24 ioctl(2) are used in the normal way and support the functionality
25 of the underlying device. In addition, some virtual console-specific
26 ioctls are provided and described below.
27
28
29 The VT provides a link between different screen faces and the device.
30 The active virtual console corresponds to the currently visible screen
31 face. Device input is directed to the active console and any device-
32 specific modes that change on a per virtual terminal basis are set to
33 the characteristics associated with the active console.
34
35
36 You manage VT's by intercepting keyboard sequences ("hot key"). To
37 maintain consistency with Xserver, the virtual console device driver
38 supports the Ctrl, Alt, F# and arrow keys.
39
40
41 The sequence AltL + F# (where AltL represents the Alt key and F# repre‐
42 sents function keys 1 through 12) is used to select virtual console
43 1-12. The sequence AltGraph + F# (where AltGraph represents the right
44 Alt key and F# represent function keys 1 through 12) is for virtual
45 console 13-24. Alt + F1 chooses the system console (also known as vir‐
46 tual console 1). The sequence Alt + -> (where ">" represents the right
47 directional arrow) selects the next VT in a circular ring fashion and
48 Alt + <- ( where "<" represents the left directional arrow) changes to
49 the previous console in a circular fashion. The sequence Alt + ^
50 (where "^" represents the up directional arrow) is for the last used
51 console.
52
53
54 Virtual console switching can be done automatically (VT_AUTO) on
55 receipt of a ``hot-key'' or by the process owning the VT (VT_PROCESS).
56 When performed automatically, the process associated with the virtual
57 console is unaware of the switch. Saving and restoring the device are
58 handled by the underlying device driver and the virtual console man‐
59 ager. Note that automatic switching is the default mode.
60
61
62 When a ``hot-key'' is sent when in process-controlled switch mode, the
63 process owning the VT is sent a signal (relsig) it has specified to the
64 virtual console manager (see signal(3C)) requesting the process to
65 release the physical device. At this point, the virtual console manager
66 awaits the VT_RELDISP ioctl from the process. If the process refuses to
67 release the device (meaning the switch does not occur), it performs a
68 VT_RELDISP ioctl with an argument of 0 (zero). If the process desires
69 to release the device, it saves the device state (keyboard, display,
70 and I/O registers) and then performs a VT_RELDISP with an argument of 1
71 to complete the switch.
72
73
74 A ring of VT's can contain intermixed auto mode and process control
75 mode consoles. When an auto mode process becomes active, the underly‐
76 ing device driver and the virtual console manager handle the restoring
77 of the device. Process control mode processes are sent a specified
78 signal (acqsig) when they become the active console. The process then
79 restores the device state (keyboard, display, and I/O registers) and
80 performs VT_RELDISP ioctl with an argument of VT_ACKACQ to complete the
81 switching protocol.
82
83
84 The modify-operations ioctls (VT_SETMODE, VT_RELDISP, VT_WAITACTIVE,
85 KDSETMODE) check if the VT is the controlling tty of the calling
86 process. If not, the sys_devices privilege is enforced. VT_ACTIVATE
87 requires the sys_devices privilege. Note that there is no controlling
88 tty and privilege check for query/view operations.
89
91 The following ioctls apply to devices that support virtual consoles:
92
93 VT_ENABLED
94
95 Queries to determine if VT functionality is available on the sys‐
96 tem. The argument is a pointer to an integer. If VT functionality
97 is available, the integer is 1, otherwise it is 0.
98
99
100 VT_OPENQRY
101
102 Finds an available VT. The argument is a pointer to an integer. The
103 integer is filled in with the number of the first available console
104 that no other process has open (and hence, is available to be
105 opened). If there are no available VT's, -1 is filled in.
106
107
108 VT_GETMODE
109
110 Determines the VT's current mode, either VT_AUTO or VT_PROCESS. The
111 argument is the address of the following structure, as defined in
112 <sys/vt.h>
113
114 struct vt_mode {
115 char mode; /* VT mode */
116 char waitv; /* not used */
117 short relsig;/* signal to use for release request */
118 short acqsig;/* signal to use for display acquired */
119 short frsig;/* not used */
120 }
121
122 /* Virtual console Modes */
123 #define VT_AUTO 0 /* automatic VT switching */
124 #define VT_PROCESS 1 /* process controls switching */
125
126
127 The structure will be filled in with the current value
128 for each field.
129
130
131
132 VT_SETMODE
133
134 Sets the VT mode. The argument is a pointer to a vt_mode structure
135 as defined above. The structure should be filled in with the
136 desired mode. If process-control mode is specified, the signals
137 used to communicate with the process should be specified. If any
138 signals are not specified (value is zero), the signal default is
139 SIGUSR1 (for relsig and acqsig).
140
141
142 VT_RELDISP
143
144 Tells the VT manager if the process releases (or refuses to
145 release) the display. An argument of 1 indicates the VT is
146 released. An argument of 0 indicates refusal to release. The
147 VT_ACKACQ argument indicates if acquisition of the VT has been com‐
148 pleted.
149
150
151 VT_ACTIVATE
152
153 Makes the VT specified in the argument the active VT (in the same
154 manner as if a hotkey initiated the switch). If the specified VT
155 is not open or does not exist, the call fails and errno is set to
156 ENXIO.
157
158
159 VT_WAITACTIVE
160
161 If the specified VT is currently active, this call returns immedi‐
162 ately. Otherwise, it sleeps until the specified VT becomes
163 active, at which point it returns.
164
165
166 VT_GETSTATE
167
168 Obtains the active VT number and a list of open VTs. The argument
169 is an address to the following structure:
170
171 struct vt_stat {
172 unsigned short v_active, /* number of the active VT */
173 v_signal, /* not used */
174 v_state; /* count of open VTs. For every 1 in this
175 field, there is an open VT */
176 }
177
178 With VT_GETSTATE, the VT manager first gets the number of the
179 active VT, then determines the number of open VTs in the system and
180 sets a 1 for each open VT in v_state. Next, the VT manager trans‐
181 fers the information in structure vt_stat passed by the user
182 process.
183
184
185 KDGETMODE
186
187 Obtains the text/graphics mode associated with the VT.
188
189 #define KD_TEXT 0
190 #define KD_GRAPHICS 1
191
192
193
194 KDSETMODE
195
196 Sets the text/graphics mode to the VT.
197
198 KD_TEXT indicates that console text is displayed on the screen.
199 Normally KD_TEXT is combined with VT_AUTO mode for text console
200 terminals, so that the console text display automatically is saved
201 and restored on the hot key screen switches.
202
203 KD_GRAPHICS indicates that the user/application (usually Xserver)
204 has direct control of the display for this VT in graphics mode.
205 Normally KD_GRAPHICS is combined with VT_PROCESS mode for this VT
206 indicating direct control of the display in graphics mode. In this
207 mode, all writes to the VT using the write system call are ignored,
208 and you must save and restore the display on the hot key screen
209 switches.
210
211 When the mode of the active VT is changed from KD_TEXT to KD_GRAPH‐
212 ICS or a VT of KD_GRAPHICS mode is made active from a previous
213 active VT of KD_TEXT mode, the virtual console manager initiates a
214 KDSETMODE ioctl with KD_GRAPHICS as the argument to the underlying
215 console frame buffer device indicating that current display is run‐
216 ning into graphics mode.
217
218 When the mode of the active VT is changed from KD_GRAPHICS to
219 KD_TEXT or a VT of KD_TEXT mode is actived from a previous active
220 VT of KD_GRAPHICS mode, the virtual console manager initiates a
221 KDSETMODE ioctl with KD_TEXT as the argument to the underlying con‐
222 sole frame buffer device indicating that current display is running
223 into console text mode.
224
225
227 /dev/vt/# VT devices.
228
229
231 ioctl(2), signal(3C), wscons(7D)
232
234 By default, there are only five virtual console instance login prompts
235 running on /dev/vt/# (where "#" represents 2 to 6) in addition to the
236 system console running on /dev/console. Normally Xorg uses the seventh
237 virtual console (/dev/vt/7.) To switch from consoles to Xserver (which
238 normally picks up the first available virtual console), use [ Ctrl + ]
239 Alt + F7 .
240
241 # svcs | grep login
242 online 17:49:11 svc:/system/console-login:default
243 online 17:49:11 svc:/system/console-login:vt2
244 online 17:49:11 svc:/system/console-login:vt3
245 online 17:49:11 svc:/system/console-login:vt4
246 online 17:49:11 svc:/system/console-login:vt5
247 online 17:49:11 svc:/system/console-login:vt6
248
249 console-login:default is for the system console, others for
250 virtual consoles.
251
252 You can modify properties/disable/enable and remove/add
253 virtual consoles using smf(5):
254
255 # svccfg -s console-login add vt8
256 # svccfg -s console-login:vt8 setprop ttymon/device=astring: "/dev/vt/8"
257 # svcadm enable console-login:vt8
258
259
260
261
262SunOS 5.11 22 Sep 2008 vt(7I)