Debian Codegraph @

upstream/debian-unstable/man2/ioctl_vt.2

raw
1 '\" t
2 .\" Copyright 1995, James R. Van Zandt <[email protected]>
3 .\" Copyright 1995, Andries E. Brouwer <[email protected]>
4 .\" Copyright 1995, Rickard E. Faith <[email protected]>
5 .\" Copyright 1995, H. Peter Anvin <[email protected]>
6 .\" Copyright, the authors of the Linux man-pages project
7 .\"
8 .\" SPDX-License-Identifier: GPL-2.0-or-later
9 .\"
10 .\" FIXME The following are not documented:
11 .\" VT_LOCKSWITCH (since Linux 1.3.47, needs CAP_SYS_TTY_CONFIG)
12 .\" VT_UNLOCKSWITCH (since Linux 1.3.47, needs CAP_SYS_TTY_CONFIG)
13 .\" VT_GETHIFONTMASK (since Linux 2.6.18)
14 .\"
15 .TH ioctl_vt 2 2026-02-08 "Linux man-pages 6.18"
16 .SH NAME
17 ioctl_vt
18 \-
19 ioctls for console terminal and virtual consoles
20 .SH SYNOPSIS
21 .nf
22 .BR "#include <linux/vt.h>" " /* Definition of " VT_* " constants */"
23 .B #include <sys/ioctl.h>
24 .P
25 .BI "int ioctl(int " fd ", unsigned long " op ", void *" argp );
26 .fi
27 .SH DESCRIPTION
28 The following Linux-specific
29 .BR ioctl (2)
30 operations are supported for console terminals and virtual consoles.
31 .TP
32 .B VT_OPENQRY
33 Returns the first available (non-opened) console.
34 .I argp
35 points to an
36 .I int
37 which is set to the
38 number of the vt (1 <=
39 .I *argp
40 <= MAX_NR_CONSOLES).
41 .TP
42 .B VT_GETMODE
43 Get mode of active vt.
44 .I argp
45 points to a
46 .IP
47 .in +4n
48 .EX
49 struct vt_mode {
50 char mode; /* vt mode */
51 char waitv; /* if set, hang on writes if not active */
52 short relsig; /* signal to raise on release op */
53 short acqsig; /* signal to raise on acquisition */
54 short frsig; /* unused (set to 0) */
55 };
56 .EE
57 .in
58 .IP
59 which is set to the mode of the active vt.
60 .I mode
61 is set to one of these values:
62 .TS
63 l l.
64 VT_AUTO auto vt switching
65 VT_PROCESS process controls switching
66 VT_ACKACQ acknowledge switch
67 .TE
68 .TP
69 .B VT_SETMODE
70 Set mode of active vt.
71 .I argp
72 points to a
73 .IR "struct vt_mode" .
74 .TP
75 .B VT_GETSTATE
76 Get global vt state info.
77 .I argp
78 points to a
79 .IP
80 .in +4n
81 .EX
82 struct vt_stat {
83 unsigned short v_active; /* active vt */
84 unsigned short v_signal; /* signal to send */
85 unsigned short v_state; /* vt bit mask */
86 };
87 .EE
88 .in
89 .IP
90 For each vt in use, the corresponding bit in the
91 .I v_state
92 member is set.
93 (Linux 1.0 through Linux 1.1.92.)
94 .TP
95 .B VT_RELDISP
96 Release a display.
97 .TP
98 .B VT_ACTIVATE
99 Switch to vt
100 .I argp
101 (1 <=
102 .I argp
103 <= MAX_NR_CONSOLES).
104 .TP
105 .B VT_WAITACTIVE
106 Wait until vt
107 .I argp
108 has been activated.
109 .TP
110 .B VT_DISALLOCATE
111 Deallocate the memory associated with vt
112 .IR argp .
113 (Since Linux 1.1.54.)
114 .TP
115 .B VT_RESIZE
116 Set the kernel's idea of screensize.
117 .I argp
118 points to a
119 .IP
120 .in +4n
121 .EX
122 struct vt_sizes {
123 unsigned short v_rows; /* # rows */
124 unsigned short v_cols; /* # columns */
125 unsigned short v_scrollsize; /* no longer used */
126 };
127 .EE
128 .in
129 .IP
130 Note that this does not change the videomode.
131 See
132 .BR resizecons (8).
133 (Since Linux 1.1.54.)
134 .TP
135 .B VT_RESIZEX
136 Set the kernel's idea of various screen parameters.
137 .I argp
138 points to a
139 .IP
140 .in +4n
141 .EX
142 struct vt_consize {
143 unsigned short v_rows; /* number of rows */
144 unsigned short v_cols; /* number of columns */
145 unsigned short v_vlin; /* number of pixel rows
146 on screen */
147 unsigned short v_clin; /* number of pixel rows
148 per character */
149 unsigned short v_vcol; /* number of pixel columns
150 on screen */
151 unsigned short v_ccol; /* number of pixel columns
152 per character */
153 };
154 .EE
155 .in
156 .IP
157 Any parameter may be set to zero, indicating "no change", but if
158 multiple parameters are set, they must be self-consistent.
159 Note that this does not change the videomode.
160 See
161 .BR resizecons (8).
162 (Since Linux 1.3.3.)
163 .TP
164 .B VT_GETCONSIZECSRPOS
165 Get console size and cursor position.
166 .I argp
167 points to a
168 .IP
169 .in +4n
170 .EX
171 struct vt_consizecsrpos {
172 __u16 con_rows; /* number of console rows */
173 __u16 con_cols; /* number of console columns */
174 __u16 csr_row; /* current cursor's row */
175 __u16 csr_col; /* current cursor's column */
176 };
177 .EE
178 .in
179 .IP
180 (Since Linux 6.16.)
181 .SH RETURN VALUE
182 On success, 0 is returned (except where indicated).
183 On failure, \-1 is returned, and
184 .I errno
185 is set to indicate the error.
186 .SH ERRORS
187 .TP
188 .B EINVAL
189 .I argp
190 is invalid.
191 .SH STANDARDS
192 Linux.
193 .SH SEE ALSO
194 .BR ioctl (2),
195 .BR ioctl_console (2)