1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
.\" Copyright (c) 2017, Joyent, Inc.
.\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.Dd October 29, 2017
.Dt VT 7I
.Os
.Sh NAME
.Nm vt
.Nd Solaris virtual console interface
.Sh SYNOPSIS
.In sys/kd.h
.In sys/vt.h
.Sh DESCRIPTION
The virtual console device driver \(em also known as virtual terminal
.Pq Sy VT
\(em is a layer of management functions that provides facilities to
support and switch between multiple screen faces on a single physical device.
.Pp
VT's are accessed in the same way as other devices.
The
.Xr open 2
system
call is used to open the virtual console and
.Xr read 2 ,
.Xr write 2
and
.Xr ioctl 2
are used in the normal way and support the functionality of the
underlying device.
In addition, some virtual console-specific ioctls are
provided and described below.
.Pp
The VT provides a link between different screen faces and the device.
The
.Sy "active virtual console"
corresponds to the currently visible screen face.
Device input is directed to the active console and any device-specific modes
that change on a per virtual terminal basis are set to the characteristics
associated with the active console.
.Pp
You manage VT's by intercepting keyboard sequences
.Pq Dq "hot key" .
To maintain consistency with Xserver, the virtual console device driver
supports the Ctrl, Alt, F# and arrow keys.
.Pp
The sequence
.Sy "AltL + F#"
(where AltL represents the left Alt key and F# represents function keys 1
through 12) is used to select virtual console 1-12.
The sequence
.Sy "AltGraph + F#"
(where AltGraph represents the right Alt key and F# represent function keys 1
through 12) is for virtual console 13-24.
.Sy "Alt + F1"
chooses the system console (also known as virtual console 1).
The sequence
.Sy "Alt + \(->"
(where "\(->" represents the right directional arrow)
selects the next VT in a circular ring fashion and
.Sy "Alt + \(<-"
(where "\(<-" represents the left directional arrow) changes to the previous
console in a circular fashion.
The sequence
.Sy "Alt + \(ua"
(where "\(ua" represents the up directional arrow) is for the last used console.
.Pp
Virtual console switching can be done automatically
.Pq Dv VT_AUTO
on receipt of a
.Dq hot-key
or by the process owning the VT
.Pq Dv VT_PROCESS .
When performed automatically, the process associated with the virtual console is
unaware of the switch.
Saving and restoring the device are handled by the
underlying device driver and the virtual console manager.
Note that automatic switching is the default mode.
.Pp
When a
.Dq hot-key
is sent when in process-controlled switch mode, the process
owning the VT is sent a signal (relsig) it has specified to the virtual console
manager (see
.Xr signal 3C )
requesting the process to release the physical device.
At this point, the virtual console manager awaits the
.Dv VT_RELDISP
ioctl from the process.
If the process refuses to release the device (meaning
the switch does not occur), it performs a
.Dv VT_RELDISP
ioctl with an argument of 0 (zero).
If the process desires to release the device, it saves
the device state (keyboard, display, and I/O registers) and then performs a
.Dv VT_RELDISP
with an argument of 1 to complete the switch.
.Pp
A ring of VT's can contain intermixed auto mode and process control mode
consoles.
When an auto mode process becomes active, the underlying device
driver and the virtual console manager handle the restoring of the device.
Process control mode processes are sent a specified signal (acqsig) when they
become the active console.
The process then restores the device state
(keyboard, display, and I/O registers) and performs
.Dv VT_RELDISP
ioctl with an argument of
.Dv VT_ACKACQ
to complete the switching protocol.
.Pp
The modify-operations ioctls
.Po
.Dv VT_SETMODE ,
.Dv VT_RELDISP ,
.Dv VT_WAITACTIVE ,
.Dv KDSETMODE
.Pc
check if the VT is the controlling tty of
the calling process.
If not, the sys_devices privilege is enforced.
.Dv VT_ACTIVATE
requires the sys_devices privilege.
Note that there is no
controlling tty and privilege check for query/view operations.
.Sh IOCTLS
The following ioctls apply to devices that support virtual consoles:
.Bl -tag -width VT_ENABLED
.It Dv VT_ENABLED
Queries to determine if VT functionality is available on the system.
The argument is a pointer to an integer.
If VT functionality is available, the
integer is 1, otherwise it is 0.
.It Dv VT_OPENQRY
Finds an available VT.
The argument is a pointer to an integer.
The integer is
filled in with the number of the first available console that no other process
has open (and hence, is available to be opened).
If there are no available
VT's, -1 is filled in.
.It Dv VT_GETMODE
Determines the VT's current mode, either
.Dv VT_AUTO
or
.Dv VT_PROCESS .
The
argument is the address of the following structure, as defined in
.In sys/vt.h
.Bd -literal -offset 2n
struct vt_mode {
char mode; /* VT mode */
char waitv; /* not used */
short relsig; /* signal to use for release request */
short acqsig; /* signal to use for display acquired */
short frsig; /* not used */
}
/* Virtual console Modes */
#define VT_AUTO 0 /* automatic VT switching */
#define VT_PROCESS 1 /* process controls switching */
.Ed
.Pp
The structure will be filled in with the current value for each field.
.It Dv VT_SETMODE
Sets the VT mode.
The argument is a pointer to a vt_mode structure as defined above.
The structure should be filled in with the desired mode.
If process-control mode is specified, the signals used to communicate with the
process should be specified.
If any signals are not specified (value is zero), the signal default is
.Dv SIGUSR1
(for relsig and acqsig).
.It Dv VT_RELDISP
Tells the VT manager if the process releases (or refuses to release) the
display.
An argument of 1 indicates the VT is released.
An argument of 0 indicates refusal to release.
The
.Dv VT_ACKACQ
argument indicates if acquisition of the VT has been completed.
.It Dv VT_ACTIVATE
Makes the VT specified in the argument the active VT (in the same manner as if
a hotkey initiated the switch).
If the specified VT is not open or does not exist, the call fails and errno is
set to
.Er ENXIO .
.It Dv VT_WAITACTIVE
If the specified VT is currently active, this call returns immediately.
Otherwise, it sleeps until the specified VT becomes active, at which point it
returns.
.It Dv VT_GETSTATE
Obtains the active VT number and a list of open VTs.
The argument is an address to the following structure:
.Bd -literal -offset 2n
struct vt_stat {
unsigned short v_active, /* number of the active VT */
v_signal, /* not used */
/*
* count of open VTs. For every 1 in this
* field, there is an open VT
*/
v_state;
}
.Ed
.Pp
With
.Dv VT_GETSTATE ,
the VT manager first gets the number of the active VT,
then determines the number of open VTs in the system and sets a 1 for each open
VT in v_state.
Next, the VT manager transfers the information in structure
.Vt vt_stat
passed by the user process.
.It Dv KDGETMODE
Obtains the text/graphics mode associated with the VT.
.Bd -literal -offset 2n
#define KD_TEXT 0
#define KD_GRAPHICS 1
.Ed
.It Dv KDSETMODE
Sets the text/graphics mode to the VT.
.It Dv KD_TEXT
indicates that console text is displayed on the screen.
Normally
.Dv KD_TEXT
is combined with
.Dv VT_AUTO
mode for text console terminals,
so that the console text display automatically is saved and restored on the hot
key screen switches.
.Pp
.Dv KD_GRAPHICS
indicates that the user/application (usually Xserver) has
direct control of the display for this VT in graphics mode.
Normally
.Dv KD_GRAPHICS
is combined with
.Dv VT_PROCESS
mode for this VT indicating
direct control of the display in graphics mode.
In this mode, all writes to the
VT using the write system call are ignored, and you must save and restore the
display on the hot key screen switches.
.Pp
When the mode of the active VT is changed from
.Dv KD_TEXT
to
.Dv KD_GRAPHICS
or a VT of
.Dv KD_GRAPHICS
mode is made active from a
previous active VT of
.Dv KD_TEXT
mode, the virtual console manager initiates a
.Dv KDSETMODE
ioctl with
.Dv KD_GRAPHICS
as the argument to the underlying console frame buffer device indicating that
current display is running into graphics mode.
.Pp
When the mode of the active VT is changed from
.Dv KD_GRAPHICS
to
.Dv KD_TEXT
or a VT of
.Dv KD_TEXT
mode is actived from a previous active VT of
.Dv KD_GRAPHICS
mode, the virtual console manager initiates a
.Dv KDSETMODE
ioctl with
.Dv KD_TEXT
as the argument to the underlying console frame buffer device indicating that
current display is running into console text mode.
.El
.Sh FILES
.Bl -tag -width xxxxxxxxx
.It Pa /dev/vt/#
VT devices.
.El
.Sh SEE ALSO
.Xr ioctl 2 ,
.Xr signal 3C ,
.Xr wscons 7D
.Sh NOTES
By default, there are only five virtual console instance login prompts running
on
.Pa /dev/vt/#
(where "#" represents 2 to 6) in addition to the system
console running on
.Pa /dev/console .
Normally Xorg uses the seventh virtual console
.Pq Pa /dev/vt/7 .
To switch from consoles to Xserver (which normally
picks up the first available virtual console), use [ Ctrl + ] Alt + F7 .
.Bd -literal -offset indent
# svcs | grep login
online 17:49:11 svc:/system/console-login:default
online 17:49:11 svc:/system/console-login:vt2
online 17:49:11 svc:/system/console-login:vt3
online 17:49:11 svc:/system/console-login:vt4
online 17:49:11 svc:/system/console-login:vt5
online 17:49:11 svc:/system/console-login:vt6
.Ed
.Pp
.Sy console-login:default
is for the system console, others for virtual consoles.
.Pp
You can modify properties/disable/enable and remove/add virtual consoles using
.Xr smf 5 :
.Bd -literal -offset indent
# svccfg -s console-login add vt8
# svccfg -s console-login:vt8 setprop \e
ttymon/device=astring: "/dev/vt/8"
# svcadm enable console-login:vt8
.Ed
|