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
|
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: GPL-2.0-or-later
.\"
.TH TIOCLINUX 2const 2025-06-11 "Linux man-pages (unreleased)"
.SH NAME
TIOCLINUX
\-
ioctls for console terminal and virtual consoles
.SH SYNOPSIS
.nf
.BR "#include <linux/tiocl.h>" " /* Definition of " TIOCL_* " constants */"
.B #include <sys/ioctl.h>
.P
.BI "int ioctl(int " fd ", TIOCLINUX, void *" argp );
.fi
.SH DESCRIPTION
The action of the following ioctls depends on the first byte in the struct
pointed to by
.IR argp ,
referred to here as the
.IR subcode .
These are legal only for the superuser or the owner of the current terminal.
.TP
.BR subcode = 0
Dump the screen.
Disappeared in Linux 1.1.92.
(With Linux 1.1.92 or later, read from
.IR /dev/vcs N
or
.IR /dev/vcsa N
instead.)
.TP
.BR subcode = 1
Get task information.
Disappeared in Linux 1.1.92.
.TP
.BR subcode = TIOCL_SETSEL
Set selection.
.I argp
points to a
.IP
.in +4n
.EX
struct {
char subcode;
short xs, ys, xe, ye;
short sel_mode;
};
.EE
.in
.IP
.I xs
and
.I ys
are the starting column and row.
.I xe
and
.I ye
are the ending
column and row.
(Upper left corner is row=column=1.)
.I sel_mode
may be one of the following operations:
.RS
.TP
.B TIOCL_SELCHAR
Select character-by-character.
The indicated screen characters are highlighted
and saved in a kernel buffer.
.IP
Since Linux 6.7, using this selection mode requires the
.B CAP_SYS_ADMIN
capability.
.TP
.B TIOCL_SELWORD
Select word-by-word,
expanding the selection outwards to align with word boundaries.
The indicated screen characters are highlighted
and saved in a kernel buffer.
.IP
Since Linux 6.7, using this selection mode requires the
.B CAP_SYS_ADMIN
capability.
.TP
.B TIOCL_SELLINE
Select line-by-line,
expanding the selection outwards to select full lines.
The indicated screen characters are highlighted
and saved in a kernel buffer.
.IP
Since Linux 6.7, using this selection mode requires the
.B CAP_SYS_ADMIN
capability.
.TP
.B TIOCL_SELPOINTER
Show the pointer at position
.RI ( xs ,\~ ys )
or
.RI ( xe ,\~ ye ),
whichever is later in text flow order.
.TP
.B TIOCL_SELCLEAR
Remove the current selection highlight, if any,
from the console holding the selection.
.IP
This does not affect the stored selected text.
.TP
.B TIOCL_SELMOUSEREPORT
Make the terminal report
.RI ( xs ,\~ ys )
as the current mouse location
using the
.BR xterm (1)
mouse tracking protocol
(see
.BR console_codes (4)).
The lower 4 bits of
.I sel_mode
.RB ( TIOCL_SELBUTTONMASK )
indicate the desired button press and
modifier key information for the mouse event.
.\" <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Normal-tracking-mode>
.IP
If mouse reporting is not enabled for the terminal,
this operation yields an
.B EINVAL
error.
.IP
Since Linux 6.7, using this selection mode requires the
.B CAP_SYS_ADMIN
capability.
.RE
.TP
.BR subcode = TIOCL_PASTESEL
Paste selection.
The characters in the selection buffer are
written to
.IR fd .
.IP
Since Linux 6.7, using this subcode requires the
.B CAP_SYS_ADMIN
capability.
.TP
.BR subcode = TIOCL_UNBLANKSCREEN
Unblank the screen.
.TP
.BR subcode = TIOCL_SELLOADLUT
Sets contents of a 256-bit look up table defining characters in a "word",
for word-by-word selection.
(Since Linux 1.1.32.)
.IP
Since Linux 6.7, using this subcode requires the
.B CAP_SYS_ADMIN
capability.
.TP
.BR subcode = TIOCL_GETSHIFTSTATE
.I argp
points to a char which is set to the value of the kernel
variable
.IR shift_state .
(Since Linux 1.1.32.)
.TP
.BR subcode = TIOCL_GETMOUSEREPORTING
.I argp
points to a char which is set to the value of the kernel
variable
.IR report_mouse .
(Since Linux 1.1.33.)
.TP
.BR subcode = 8
Dump screen width and height, cursor position, and all the
character-attribute pairs.
(Linux 1.1.67 through Linux 1.1.91 only.
With Linux 1.1.92 or later, read from
.I /dev/vcsa*
instead.)
.TP
.BR subcode = 9
Restore screen width and height, cursor position, and all the
character-attribute pairs.
(Linux 1.1.67 through Linux 1.1.91 only.
With Linux 1.1.92 or later, write to
.I /dev/vcsa*
instead.)
.TP
.BR subcode = TIOCL_SETVESABLANK
Handles the Power Saving
feature of the new generation of monitors.
VESA screen blanking mode is set to
.IR argp[1] ,
which governs what
screen blanking does:
.RS
.TP
.B 0
Screen blanking is disabled.
.TP
.B 1
The current video adapter
register settings are saved, then the controller is programmed to turn off
the vertical synchronization pulses.
This puts the monitor into "standby" mode.
If your monitor has an Off_Mode timer, then
it will eventually power down by itself.
.TP
.B 2
The current settings are saved, then both the vertical and horizontal
synchronization pulses are turned off.
This puts the monitor into "off" mode.
If your monitor has no Off_Mode timer,
or if you want your monitor to power down immediately when the
blank_timer times out, then you choose this option.
.RI ( Caution:
Powering down frequently will damage the monitor.)
(Since Linux 1.1.76.)
.RE
.TP
.BR subcode = TIOCL_SETKMSGREDIRECT
Change target of kernel messages ("console"):
by default, and if this is set to
.BR 0 ,
messages are written to the currently active VT.
The VT to write to is a single byte following
.BR subcode .
(Since Linux 2.5.36.)
.TP
.BR subcode = TIOCL_GETFGCONSOLE
Returns the number of VT currently in foreground.
(Since Linux 2.5.36.)
.TP
.BR subcode = TIOCL_SCROLLCONSOLE
Scroll the foreground VT by the specified amount of
.I lines
down,
or half the screen if
.BR 0 .
.I lines
is *(((int32_t *)&subcode) + 1).
(Since Linux 2.5.67.)
.TP
.BR subcode = TIOCL_BLANKSCREEN
Blank the foreground VT, ignoring "pokes" (typing):
can only be unblanked explicitly (by switching VTs, to text mode, etc.).
(Since Linux 2.5.71.)
.TP
.BR subcode = TIOCL_BLANKEDSCREEN
Returns the number of VT currently blanked,
.B 0
if none.
(Since Linux 2.5.71.)
.TP
.BR subcode = 16
Never used.
.TP
.BR subcode = TIOCL_GETKMSGREDIRECT
Returns target of kernel messages.
(Since Linux 2.6.17.)
.TP
.BR subcode = TIOCL_GETBRACKETEDPASTE
Returns
.B 1
if the application advertised bracketed paste compatibility to the terminal,
.B 0
otherwise.
(Since Linux 6.16.)
.SH RETURN VALUE
On success, 0 is returned (except where indicated).
On failure, \-1 is returned, and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EINVAL
.I argp
is invalid.
.TP
.B EPERM
Insufficient permission.
.SH STANDARDS
Linux.
.SH SEE ALSO
.BR ioctl (2),
.BR ioctl_console (2)
|