]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/ioctl_console.2
fuse.4: ffix
[thirdparty/man-pages.git] / man2 / ioctl_console.2
CommitLineData
fea681da
MK
1.\" Copyright (c) 1995 Jim Van Zandt <jrv@vanzandt.mv.com> and aeb
2.\" Sun Feb 26 11:46:23 MET 1995
3.\"
1dd72f9c 4.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
fea681da
MK
5.\" This is free documentation; you can redistribute it and/or
6.\" modify it under the terms of the GNU General Public License as
7.\" published by the Free Software Foundation; either version 2 of
8.\" the License, or (at your option) any later version.
9.\"
10.\" The GNU General Public License's references to "object code"
11.\" and "executables" are to be interpreted as the output of any
12.\" document formatting or typesetting system, including
13.\" intermediate and printed output.
14.\"
15.\" This manual is distributed in the hope that it will be useful,
16.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18.\" GNU General Public License for more details.
19.\"
20.\" You should have received a copy of the GNU General Public
c715f741
MK
21.\" License along with this manual; if not, see
22.\" <http://www.gnu.org/licenses/>.
6a8d8745 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" Modified, Sun Feb 26 15:04:20 1995, faith@cs.unc.edu
26.\" Modified, Thu Apr 20 22:08:17 1995, jrv@vanzandt.mv.com
27.\" Modified, Mon Sep 18 22:32:47 1995, hpa@storm.net (H. Peter Anvin)
c5571b61 28.\" FIXME The following are not documented:
3dbca875
MK
29.\" KDFONTOP (since 2.1.111)
30.\" KDGKBDIACRUC (since 2.6.24)
e0d8018d 31.\" KDSKBDIACR
3dbca875
MK
32.\" KDSKBDIACRUC (since 2.6.24)
33.\" KDKBDREP (since 2.1.113)
e0d8018d 34.\" KDMAPDISP (not implemented as at 2.6.27)
3dbca875 35.\" KDUNMAPDISP (not implemented as at 2.6.27)
e5f53fe5
MK
36.\" VT_LOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
37.\" VT_UNLOCKSWITCH (since 1.3.47, needs CAP_SYS_TTY_CONFIG)
3dbca875 38.\" VT_GETHIFONTMASK (since 2.6.18)
e0d8018d 39.\"
4b8c67d9 40.TH IOCTL_CONSOLE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
fea681da 41.SH NAME
693dc407 42ioctl_console \- ioctls for console terminal and virtual consoles
fea681da 43.SH DESCRIPTION
60a90ecd
MK
44The following Linux-specific
45.BR ioctl (2)
e86f51ac 46requests are supported for console terminals and virtual consoles.
7f63b1e7
MK
47Each requires a third argument, assumed here to be
48.IR argp .
49.TP
50.B KDGETLED
be7fff26 51Get state of LEDs.
7f63b1e7
MK
52.I argp
53points to a
54.IR char .
c13182ef 55The lower three bits
7f63b1e7
MK
56of
57.I *argp
58are set to the state of the LEDs, as follows:
5a4d28e5
ER
59.TS
60l l l.
61LED_CAP 0x04 caps lock led
d990dc38 62LED_NUM 0x02 num lock led
5a4d28e5
ER
63LED_SCR 0x01 scroll lock led
64.TE
7f63b1e7
MK
65.TP
66.B KDSETLED
c13182ef 67Set the LEDs.
4448aa21
MK
68The LEDs are set to correspond to the lower three bits of the
69unsigned long integer in
7f63b1e7 70.IR argp .
c13182ef 71However, if a higher order bit is set,
fea681da
MK
72the LEDs revert to normal: displaying the state of the
73keyboard functions of caps lock, num lock, and scroll lock.
dd3568a1 74.PP
5231e1bb 75Before Linux 1.1.54, the LEDs just reflected the state of the corresponding
fea681da 76keyboard flags, and KDGETLED/KDSETLED would also change the keyboard
c13182ef 77flags.
5231e1bb 78Since Linux 1.1.54 the LEDs can be made to display arbitrary
fea681da 79information, but by default they display the keyboard flags.
5a4d28e5 80The following two ioctls are used to access the keyboard flags.
7f63b1e7
MK
81.TP
82.B KDGKBLED
fea681da 83Get keyboard flags CapsLock, NumLock, ScrollLock (not lights).
7f63b1e7
MK
84.I argp
85points to a char which is set to the flag state.
fea681da
MK
86The low order three bits (mask 0x7) get the current flag state,
87and the low order bits of the next nibble (mask 0x70) get
6387216b 88the default flag state.
5231e1bb 89(Since Linux 1.1.54.)
7f63b1e7
MK
90.TP
91.B KDSKBLED
fea681da 92Set keyboard flags CapsLock, NumLock, ScrollLock (not lights).
7f63b1e7 93.I argp
4448aa21 94is an unsigned long integer that has the desired flag state.
fea681da
MK
95The low order three bits (mask 0x7) have the flag state,
96and the low order bits of the next nibble (mask 0x70) have
6387216b 97the default flag state.
5231e1bb 98(Since Linux 1.1.54.)
7f63b1e7
MK
99.TP
100.B KDGKBTYPE
c13182ef
MK
101Get keyboard type.
102This returns the value KB_101, defined as 0x02.
7f63b1e7
MK
103.TP
104.B KDADDIO
c13182ef 105Add I/O port as valid.
7f63b1e7
MK
106Equivalent to
107.IR ioperm(arg,1,1) .
108.TP
109.B KDDELIO
c13182ef 110Delete I/O port as valid.
7f63b1e7
MK
111Equivalent to
112.IR ioperm(arg,1,0) .
113.TP
114.B KDENABIO
c13182ef 115Enable I/O to video board.
7f63b1e7 116Equivalent to
d2fdb1e3 117.IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 1)" .
7f63b1e7
MK
118.TP
119.B KDDISABIO
c13182ef 120Disable I/O to video board.
7f63b1e7 121Equivalent to
d2fdb1e3 122.IR "ioperm(0x3b4, 0x3df\-0x3b4+1, 0)" .
7f63b1e7
MK
123.TP
124.B KDSETMODE
be7fff26 125Set text/graphics mode.
7f63b1e7 126.I argp
4448aa21 127is an unsigned integer containing one of:
5a4d28e5
ER
128.TS
129l l.
130KD_TEXT 0x00
131KD_GRAPHICS 0x01
132.TE
7f63b1e7
MK
133.TP
134.B KDGETMODE
be7fff26 135Get text/graphics mode.
7f63b1e7 136.I argp
40c7eed4
MK
137points to an
138.I int
7f63b1e7 139which is set to one
789353da
MK
140of the values shown above for
141.BR KDSETMODE .
7f63b1e7
MK
142.TP
143.B KDMKTONE
c13182ef 144Generate tone of specified length.
4448aa21 145The lower 16 bits of the unsigned long integer in
7f63b1e7
MK
146.I argp
147specify the period in clock cycles,
fea681da 148and the upper 16 bits give the duration in msec.
c13182ef 149If the duration is zero, the sound is turned off.
fea681da 150Control returns immediately.
7f63b1e7
MK
151For example,
152.I argp
153= (125<<16) + 0x637 would specify
fea681da 154the beep normally associated with a ctrl-G.
5231e1bb 155(Thus since Linux 0.99pl1; broken in Linux 2.1.49-50.)
7f63b1e7
MK
156.TP
157.B KIOCSOUND
c13182ef
MK
158Start or stop sound generation.
159The lower 16 bits of
7f63b1e7
MK
160.I argp
161specify the period in clock cycles
162(that is,
163.I argp
164= 1193180/frequency).
165.I argp
166= 0 turns sound off.
fea681da 167In either case, control returns immediately.
7f63b1e7
MK
168.TP
169.B GIO_CMAP
d9bfdb9c 170Get the current default color map from kernel.
7f63b1e7
MK
171.I argp
172points to
c13182ef 173a 48-byte array.
5231e1bb 174(Since Linux 1.3.3.)
7f63b1e7
MK
175.TP
176.B PIO_CMAP
d9bfdb9c 177Change the default text-mode color map.
7f63b1e7
MK
178.I argp
179points to a
fea681da 18048-byte array which contains, in order, the Red, Green, and Blue
d9bfdb9c 181values for the 16 available screen colors: 0 is off, and 255 is full
c13182ef 182intensity.
d9bfdb9c 183The default colors are, in order: black, dark red, dark
fea681da
MK
184green, brown, dark blue, dark purple, dark cyan, light grey, dark
185grey, bright red, bright green, yellow, bright blue, bright purple,
67da5267 186bright cyan and white.
5231e1bb 187(Since Linux 1.3.3.)
7f63b1e7
MK
188.TP
189.B GIO_FONT
be7fff26 190Gets 256-character screen font in expanded form.
7f63b1e7 191.I argp
f0ea168c 192points to an 8192-byte array.
7f63b1e7
MK
193Fails with error code
194.B EINVAL
195if the
fea681da
MK
196currently loaded font is a 512-character font, or if the console is
197not in text mode.
7f63b1e7
MK
198.TP
199.B GIO_FONTX
be7fff26 200Gets screen font and associated information.
7f63b1e7
MK
201.I argp
202points to a
203.I "struct consolefontdesc"
204(see
205.BR PIO_FONTX ).
c13182ef 206On call, the
7f63b1e7
MK
207.I charcount
208field should be set to the maximum number of
209characters that would fit in the buffer pointed to by
210.IR chardata .
211On return, the
212.I charcount
213and
214.I charheight
215are filled with
fea681da 216the respective data for the currently loaded font, and the
9c1b6f33 217.I chardata
7f63b1e7
MK
218array contains the font data if the initial value of
219.I charcount
220indicated enough space was available; otherwise the
221buffer is untouched and
222.I errno
223is set to
224.BR ENOMEM .
5231e1bb 225(Since Linux 1.3.1.)
7f63b1e7
MK
226.TP
227.B PIO_FONT
c13182ef
MK
228Sets 256-character screen font.
229Load font into the EGA/VGA character
be7fff26 230generator.
7f63b1e7 231.I argp
f0ea168c 232points to an 8192-byte map, with 32 bytes per
c13182ef 233character.
7f63b1e7
MK
234Only the first
235.I N
236of them are used for an 8x\fIN\fP font
237(0 <
238.I N
239<= 32).
c13182ef 240This call also invalidates the Unicode mapping.
7f63b1e7
MK
241.TP
242.B PIO_FONTX
be7fff26 243Sets screen font and associated rendering information.
7f63b1e7 244.I argp
fea681da 245points to a
e646a1ba 246.IP
3ad4ddcd 247.in +4n
b76974c1 248.EX
fea681da 249struct consolefontdesc {
c8250206
MK
250 unsigned short charcount; /* characters in font
251 (256 or 512) */
252 unsigned short charheight; /* scan lines per
d2fdb1e3 253 character (1\-32) */
c8250206
MK
254 char *chardata; /* font data in
255 expanded form */
fea681da 256};
b76974c1 257.EE
3ad4ddcd 258.in
e646a1ba 259.IP
fea681da 260If necessary, the screen will be appropriately resized, and
7f63b1e7
MK
261.B SIGWINCH
262sent to the appropriate processes.
c13182ef 263This call also invalidates the Unicode mapping.
5231e1bb 264(Since Linux 1.3.1.)
7f63b1e7
MK
265.TP
266.B PIO_FONTRESET
fea681da 267Resets the screen font, size and Unicode mapping to the bootup
c13182ef 268defaults.
7f63b1e7
MK
269.I argp
270is unused, but should be set to NULL to
67da5267 271ensure compatibility with future versions of Linux.
5231e1bb 272(Since Linux 1.3.28.)
7f63b1e7
MK
273.TP
274.B GIO_SCRNMAP
c13182ef 275Get screen mapping from kernel.
7f63b1e7
MK
276.I argp
277points to an area of size
fea681da 278E_TABSZ, which is loaded with the font positions used to display each
c13182ef
MK
279character.
280This call is likely to return useless information if the
fea681da 281currently loaded font is more than 256 characters.
7f63b1e7
MK
282.TP
283.B GIO_UNISCRNMAP
be7fff26 284Get full Unicode screen mapping from kernel.
7f63b1e7
MK
285.I argp
286points to an
287area of size
01a900f0 288.IR "E_TABSZ*sizeof(unsigned short)" ,
7f63b1e7 289which is loaded with the
c13182ef
MK
290Unicodes each character represent.
291A special set of Unicodes,
324633ae 292starting at U+F000, are used to represent "direct to font" mappings.
5231e1bb 293(Since Linux 1.3.1.)
7f63b1e7
MK
294.TP
295.B PIO_SCRNMAP
324633ae 296Loads the "user definable" (fourth) table in the kernel which maps
be7fff26 297bytes into console screen symbols.
7f63b1e7
MK
298.I argp
299points to an area of
fea681da 300size E_TABSZ.
7f63b1e7
MK
301.TP
302.B PIO_UNISCRNMAP
324633ae 303Loads the "user definable" (fourth) table in the kernel which maps
fea681da 304bytes into Unicodes, which are then translated into screen symbols
c13182ef
MK
305according to the currently loaded Unicode-to-font map.
306Special Unicodes starting at U+F000 can be used to map directly to the font
307symbols.
5231e1bb 308(Since Linux 1.3.1.)
7f63b1e7
MK
309.TP
310.B GIO_UNIMAP
be7fff26 311Get Unicode-to-font mapping from kernel.
7f63b1e7
MK
312.I argp
313points to a
b76974c1 314.IP
3ad4ddcd 315.in +4n
b76974c1 316.EX
fea681da 317struct unimapdesc {
aeb4b1fc 318 unsigned short entry_ct;
89ad8b13 319 struct unipair *entries;
fea681da 320};
b76974c1 321.EE
3ad4ddcd 322.in
b76974c1 323.IP
7f63b1e7
MK
324where
325.I entries
326points to an array of
a202ed93 327.IP
3ad4ddcd 328.in +4n
b76974c1 329.EX
fea681da 330struct unipair {
aeb4b1fc
MK
331 unsigned short unicode;
332 unsigned short fontpos;
fea681da 333};
b76974c1 334.EE
3ad4ddcd 335.in
b76974c1 336.IP
5231e1bb 337(Since Linux 1.1.92.)
7f63b1e7
MK
338.TP
339.B PIO_UNIMAP
be7fff26 340Put unicode-to-font mapping in kernel.
7f63b1e7
MK
341.I argp
342points to a
343.IR "struct unimapdesc" .
5231e1bb 344(Since Linux 1.1.92)
7f63b1e7
MK
345.TP
346.B PIO_UNIMAPCLR
be7fff26 347Clear table, possibly advise hash algorithm.
7f63b1e7
MK
348.I argp
349points to a
b76974c1 350.IP
3ad4ddcd 351.in +4n
b76974c1 352.EX
fea681da 353struct unimapinit {
aeb4b1fc
MK
354 unsigned short advised_hashsize; /* 0 if no opinion */
355 unsigned short advised_hashstep; /* 0 if no opinion */
356 unsigned short advised_hashlevel; /* 0 if no opinion */
fea681da 357};
b76974c1 358.EE
3ad4ddcd 359.in
b76974c1 360.IP
5231e1bb 361(Since Linux 1.1.92.)
7f63b1e7
MK
362.TP
363.B KDGKBMODE
be7fff26 364Gets current keyboard mode.
7f63b1e7
MK
365.I argp
366points to a
367.I long
368which is set to one
fea681da 369of these:
5a4d28e5
ER
370.TS
371l l.
baf6737e
MK
372K_RAW 0x00 /* Raw (scancode) mode */
373K_XLATE 0x01 /* Translate keycodes using keymap */
374K_MEDIUMRAW 0x02 /* Medium raw (scancode) mode */
375K_UNICODE 0x03 /* Unicode mode */
376K_OFF 0x04 /* Disabled mode; since Linux 2.6.39 */
377.\" K_OFF: commit 9fc3de9c83565fcaa23df74c2fc414bb6e7efb0a
5a4d28e5 378.TE
7f63b1e7
MK
379.TP
380.B KDSKBMODE
fea681da 381Sets current keyboard mode.
7f63b1e7
MK
382.I argp
383is a
384.I long
789353da
MK
385equal to one of the values shown for
386.BR KDGKBMODE .
7f63b1e7
MK
387.TP
388.B KDGKBMETA
be7fff26 389Gets meta key handling mode.
7f63b1e7
MK
390.I argp
391points to a
392.I long
393which is
fea681da 394set to one of these:
5a4d28e5
ER
395.TS
396l l l.
397K_METABIT 0x03 set high order bit
398K_ESCPREFIX 0x04 escape prefix
399.TE
7f63b1e7
MK
400.TP
401.B KDSKBMETA
fea681da 402Sets meta key handling mode.
7f63b1e7
MK
403.I argp
404is a
405.I long
789353da
MK
406equal to one of the values shown above for
407.BR KDGKBMETA .
7f63b1e7
MK
408.TP
409.B KDGKBENT
c13182ef 410Gets one entry in key translation table (keycode to action code).
7f63b1e7
MK
411.I argp
412points to a
b76974c1 413.IP
3ad4ddcd 414.in +4n
b76974c1 415.EX
fea681da 416struct kbentry {
aeb4b1fc
MK
417 unsigned char kb_table;
418 unsigned char kb_index;
419 unsigned short kb_value;
fea681da 420};
b76974c1 421.EE
3ad4ddcd 422.in
b76974c1 423.IP
c13182ef 424with the first two members filled in:
7f63b1e7
MK
425.I kb_table
426selects the key table (0 <=
427.I kb_table
428< MAX_NR_KEYMAPS),
429and
430.IR kb_index
431is the keycode (0 <=
432.I kb_index
433< NR_KEYS).
434.I kb_value
435is set to the corresponding action code,
c13182ef 436or K_HOLE if there is no such key,
7f63b1e7
MK
437or K_NOSUCHMAP if
438.I kb_table
439is invalid.
440.TP
441.B KDSKBENT
be7fff26 442Sets one entry in translation table.
7f63b1e7
MK
443.I argp
444points to a
445.IR "struct kbentry" .
446.TP
447.B KDGKBSENT
be7fff26 448Gets one function key string.
7f63b1e7
MK
449.I argp
450points to a
b76974c1 451.IP
3ad4ddcd 452.in +4n
b76974c1 453.EX
fea681da 454struct kbsentry {
aeb4b1fc
MK
455 unsigned char kb_func;
456 unsigned char kb_string[512];
fea681da 457};
b8302363 458.EE
3ad4ddcd 459.in
b76974c1 460.IP
7f63b1e7
MK
461.I kb_string
462is set to the (null-terminated) string corresponding to
463the
464.IR kb_func th
465function key action code.
466.TP
467.B KDSKBSENT
be7fff26 468Sets one function key string entry.
7f63b1e7
MK
469.I argp
470points to a
471.IR "struct kbsentry" .
472.TP
473.B KDGKBDIACR
be7fff26 474Read kernel accent table.
7f63b1e7
MK
475.I argp
476points to a
b76974c1 477.IP
3ad4ddcd 478.in +4n
b76974c1 479.EX
c13182ef 480struct kbdiacrs {
89ad8b13
MK
481 unsigned int kb_cnt;
482 struct kbdiacr kbdiacr[256];
fea681da 483};
b76974c1 484.EE
3ad4ddcd 485.in
b76974c1 486.IP
7f63b1e7
MK
487where
488.I kb_cnt
489is the number of entries in the array, each of which
fea681da 490is a
b76974c1 491.IP
3ad4ddcd 492.in +4n
b76974c1 493.EX
c13182ef 494struct kbdiacr {
aeb4b1fc
MK
495 unsigned char diacr;
496 unsigned char base;
497 unsigned char result;
fea681da 498};
b76974c1 499.EE
3ad4ddcd 500.in
7f63b1e7
MK
501.TP
502.B KDGETKEYCODE
c13182ef 503Read kernel keycode table entry (scan code to keycode).
7f63b1e7
MK
504.I argp
505points to a
b76974c1 506.IP
3ad4ddcd 507.in +4n
b76974c1 508.EX
c13182ef 509struct kbkeycode {
89ad8b13
MK
510 unsigned int scancode;
511 unsigned int keycode;
cf0a9ace 512};
b76974c1 513.EE
3ad4ddcd 514.in
b76974c1 515.IP
7f63b1e7
MK
516.I keycode
517is set to correspond to the given
518.IR scancode .
519(89 <=
520.I scancode
521<= 255 only.
522For 1 <=
523.I scancode
524<= 88,
525.IR keycode == scancode .)
5231e1bb 526(Since Linux 1.1.63.)
7f63b1e7
MK
527.TP
528.B KDSETKEYCODE
be7fff26 529Write kernel keycode table entry.
7f63b1e7
MK
530.I argp
531points to a
532.IR "struct kbkeycode" .
5231e1bb 533(Since Linux 1.1.63.)
7f63b1e7
MK
534.TP
535.B KDSIGACCEPT
fea681da 536The calling process indicates its willingness to accept the signal
7f63b1e7
MK
537.I argp
538when it is generated by pressing an appropriate key combination.
539(1 <=
540.I argp
541<= NSIG).
542(See
543.IR spawn_console ()
544in
545.IR linux/drivers/char/keyboard.c .)
546.TP
547.B VT_OPENQRY
fea681da 548Returns the first available (non-opened) console.
7f63b1e7
MK
549.I argp
550points to an
551.I int
552which is set to the
553number of the vt (1 <=
554.I *argp
555<= MAX_NR_CONSOLES).
556.TP
557.B VT_GETMODE
be7fff26 558Get mode of active vt.
7f63b1e7
MK
559.I argp
560points to a
b76974c1 561.IP
3ad4ddcd 562.in +4n
b76974c1 563.EX
fea681da 564struct vt_mode {
89ad8b13
MK
565 char mode; /* vt mode */
566 char waitv; /* if set, hang on writes if not active */
567 short relsig; /* signal to raise on release req */
568 short acqsig; /* signal to raise on acquisition */
569 short frsig; /* unused (set to 0) */
fea681da 570};
b76974c1 571.EE
3ad4ddcd 572.in
b76974c1 573.IP
c13182ef 574which is set to the mode of the active vt.
7f63b1e7
MK
575.I mode
576is set to one of these values:
5a4d28e5
ER
577.TS
578l l.
579VT_AUTO auto vt switching
580VT_PROCESS process controls switching
581VT_ACKACQ acknowledge switch
582.TE
7f63b1e7
MK
583.TP
584.B VT_SETMODE
be7fff26 585Set mode of active vt.
7f63b1e7
MK
586.I argp
587points to a
588.IR "struct vt_mode" .
589.TP
590.B VT_GETSTATE
be7fff26 591Get global vt state info.
7f63b1e7
MK
592.I argp
593points to a
b76974c1 594.IP
3ad4ddcd 595.in +4n
b76974c1 596.EX
fea681da 597struct vt_stat {
aeb4b1fc
MK
598 unsigned short v_active; /* active vt */
599 unsigned short v_signal; /* signal to send */
600 unsigned short v_state; /* vt bit mask */
fea681da 601};
b76974c1 602.EE
3ad4ddcd 603.in
b76974c1 604.IP
7f63b1e7
MK
605For each vt in use, the corresponding bit in the
606.I v_state
607member is set.
fea681da 608(Kernels 1.0 through 1.1.92.)
7f63b1e7
MK
609.TP
610.B VT_RELDISP
fea681da 611Release a display.
7f63b1e7
MK
612.TP
613.B VT_ACTIVATE
614Switch to vt
615.IR argp
616(1 <=
617.I argp
618<= MAX_NR_CONSOLES).
619.TP
620.B VT_WAITACTIVE
621Wait until vt
622.I argp
623has been activated.
624.TP
625.B VT_DISALLOCATE
626Deallocate the memory associated with vt
627.IR argp .
5231e1bb 628(Since Linux 1.1.54.)
7f63b1e7
MK
629.TP
630.B VT_RESIZE
be7fff26 631Set the kernel's idea of screensize.
7f63b1e7
MK
632.I argp
633points to a
b76974c1 634.IP
3ad4ddcd 635.in +4n
b76974c1 636.EX
fea681da 637struct vt_sizes {
aeb4b1fc
MK
638 unsigned short v_rows; /* # rows */
639 unsigned short v_cols; /* # columns */
640 unsigned short v_scrollsize; /* no longer used */
fea681da 641};
b76974c1 642.EE
3ad4ddcd 643.in
b76974c1 644.IP
fea681da 645Note that this does not change the videomode.
c13182ef 646See
b5cc2ffb 647.BR resizecons (8).
5231e1bb 648(Since Linux 1.1.54.)
7f63b1e7
MK
649.TP
650.B VT_RESIZEX
be7fff26 651Set the kernel's idea of various screen parameters.
7f63b1e7
MK
652.I argp
653points to a
b76974c1 654.IP
3ad4ddcd 655.in +4n
b76974c1 656.EX
fea681da 657struct vt_consize {
aeb4b1fc
MK
658 unsigned short v_rows; /* number of rows */
659 unsigned short v_cols; /* number of columns */
c8250206
MK
660 unsigned short v_vlin; /* number of pixel rows
661 on screen */
662 unsigned short v_clin; /* number of pixel rows
663 per character */
664 unsigned short v_vcol; /* number of pixel columns
665 on screen */
666 unsigned short v_ccol; /* number of pixel columns
667 per character */
fea681da 668};
b76974c1 669.EE
3ad4ddcd 670.in
b76974c1 671.IP
324633ae 672Any parameter may be set to zero, indicating "no change", but if
c13182ef
MK
673multiple parameters are set, they must be self-consistent.
674Note that this does not change the videomode.
675See
a7e1c01a 676.BR resizecons (8).
5231e1bb 677(Since Linux 1.3.3.)
fea681da 678.PP
c13182ef 679The action of the following ioctls depends on the first byte in the struct
7f63b1e7
MK
680pointed to by
681.IR argp ,
682referred to here as the
683.IR subcode .
1285ff3d 684These are legal only for the superuser or the owner of the current terminal.
7f63b1e7
MK
685.TP
686.B "TIOCLINUX, subcode=0"
fea681da 687Dump the screen.
5231e1bb 688Disappeared in Linux 1.1.92. (With kernel 1.1.92 or later, read from
7f63b1e7
MK
689.I /dev/vcsN
690or
691.I /dev/vcsaN
692instead.)
693.TP
694.B "TIOCLINUX, subcode=1"
c13182ef 695Get task information.
5231e1bb 696Disappeared in Linux 1.1.92.
7f63b1e7
MK
697.TP
698.B "TIOCLINUX, subcode=2"
fea681da 699Set selection.
7f63b1e7
MK
700.I argp
701points to a
b76974c1 702.IP
66812c74 703.in +4n
b76974c1 704.EX
cf0a9ace 705struct {
b76974c1
MK
706 char subcode;
707 short xs, ys, xe, ye;
708 short sel_mode;
3ad4ddcd 709};
b76974c1 710.EE
66812c74 711.in
b76974c1 712.IP
7f63b1e7
MK
713.I xs
714and
715.I ys
716are the starting column and row.
717.I xe
718and
719.I ye
720are the ending
c13182ef
MK
721column and row.
722(Upper left corner is row=column=1.)
7f63b1e7
MK
723.I sel_mode
724is 0 for character-by-character selection,
c13182ef 7251 for word-by-word selection,
fea681da 726or 2 for line-by-line selection.
c13182ef 727The indicated screen characters are highlighted and saved
7f63b1e7
MK
728in the static array sel_buffer in
729.IR devices/char/console.c .
730.TP
731.B "TIOCLINUX, subcode=3"
fea681da
MK
732Paste selection.
733The characters in the selection buffer are
7f63b1e7
MK
734written to
735.IR fd .
736.TP
737.B "TIOCLINUX, subcode=4"
fea681da 738Unblank the screen.
7f63b1e7
MK
739.TP
740.B "TIOCLINUX, subcode=5"
fea681da 741Sets contents of a 256-bit look up table defining characters in a "word",
67da5267 742for word-by-word selection.
5231e1bb 743(Since Linux 1.1.32.)
7f63b1e7
MK
744.TP
745.B "TIOCLINUX, subcode=6"
746.I argp
747points to a char which is set to the value of the kernel
748variable
749.IR shift_state .
5231e1bb 750(Since Linux 1.1.32.)
7f63b1e7
MK
751.TP
752.B "TIOCLINUX, subcode=7"
753.I argp
754points to a char which is set to the value of the kernel
755variable
756.IR report_mouse .
5231e1bb 757(Since Linux 1.1.33.)
7f63b1e7
MK
758.TP
759.B "TIOCLINUX, subcode=8"
c13182ef 760Dump screen width and height, cursor position, and all the
fea681da 761character-attribute pairs.
c13182ef 762(Kernels 1.1.67 through 1.1.91 only.
7f63b1e7
MK
763With kernel 1.1.92 or later, read from
764.I /dev/vcsa*
765instead.)
766.TP
767.B "TIOCLINUX, subcode=9"
c13182ef 768Restore screen width and height, cursor position, and all the
fea681da 769character-attribute pairs.
c13182ef 770(Kernels 1.1.67 through 1.1.91 only.
7f63b1e7
MK
771With kernel 1.1.92 or later, write to
772.I /dev/vcsa*
773instead.)
774.TP
775.B "TIOCLINUX, subcode=10"
fea681da 776Handles the Power Saving
c13182ef 777feature of the new generation of monitors.
7f63b1e7
MK
778VESA screen blanking mode is set to
779.IR argp[1] ,
780which governs what
fea681da 781screen blanking does:
7f63b1e7
MK
782.RS
783.IP 0: 3
784Screen blanking is disabled.
785.IP 1:
786The current video adapter
fea681da 787register settings are saved, then the controller is programmed to turn off
c13182ef 788the vertical synchronization pulses.
35478399 789This puts the monitor into "standby" mode.
c13182ef 790If your monitor has an Off_Mode timer, then
fea681da 791it will eventually power down by itself.
7f63b1e7
MK
792.IP 2:
793The current settings are saved, then both the vertical and horizontal
c13182ef 794synchronization pulses are turned off.
fea681da
MK
795This puts the monitor into "off" mode.
796If your monitor has no Off_Mode timer,
797or if you want your monitor to power down immediately when the
c13182ef 798blank_timer times out, then you choose this option.
7f63b1e7
MK
799.RI ( Caution:
800Powering down frequently will damage the monitor.)
5231e1bb 801(Since Linux 1.1.76.)
7f63b1e7 802.RE
47297adb 803.SH RETURN VALUE
c13182ef 804On success, 0 is returned.
7f63b1e7
MK
805On error, \-1 is returned, and
806.I errno
807is set.
fea681da 808.SH ERRORS
7f63b1e7
MK
809.I errno
810may take on these values:
fea681da
MK
811.TP
812.B EBADF
813The file descriptor is invalid.
814.TP
fea681da 815.B EINVAL
7f63b1e7
MK
816The file descriptor or
817.I argp
818is invalid.
fea681da 819.TP
228234e4
MK
820.B ENOTTY
821The file descriptor is not associated with a character special device,
822or the specified request does not apply to it.
823.TP
fea681da
MK
824.B EPERM
825Insufficient permission.
9ba9cb64
MK
826.SH NOTES
827.BR Warning :
5a4d28e5 828Do not regard this man page as documentation of the Linux console ioctls.
fea681da 829This is provided for the curious only, as an alternative to reading the
c13182ef
MK
830source.
831Ioctl's are undocumented Linux internals, liable to be changed
832without warning.
833(And indeed, this page more or less describes the
834situation as of kernel version 1.1.94;
835there are many minor and not-so-minor
fea681da 836differences with earlier versions.)
e646a1ba 837.PP
5a4d28e5 838Very often, ioctls are introduced for communication between the
fea681da
MK
839kernel and one particular well-known program (fdisk, hdparm, setserial,
840tunelp, loadkeys, selection, setfont, etc.), and their behavior will be
841changed when required by this particular program.
e646a1ba 842.PP
5a4d28e5 843Programs using these ioctls will not be portable to other versions
008f1ecc 844of UNIX, will not work on older versions of Linux, and will not work
fea681da 845on future versions of Linux.
e646a1ba 846.PP
fea681da 847Use POSIX functions.
47297adb 848.SH SEE ALSO
fea681da
MK
849.BR dumpkeys (1),
850.BR kbd_mode (1),
851.BR loadkeys (1),
852.BR mknod (1),
853.BR setleds (1),
854.BR setmetamode (1),
855.BR execve (2),
856.BR fcntl (2),
a9168840 857.BR ioctl_tty (2),
fea681da
MK
858.BR ioperm (2),
859.BR termios (3),
fea681da
MK
860.BR console_codes (4),
861.BR mt (4),
862.BR sd (4),
863.BR tty (4),
f82a9fac 864.BR ttyS (4),
fea681da
MK
865.BR vcs (4),
866.BR vcsa (4),
867.BR charsets (7),
868.BR mapscrn (8),
869.BR resizecons (8),
173fe7e7 870.BR setfont (8)
e646a1ba 871.PP
fea681da
MK
872.IR /usr/include/linux/kd.h ,
873.I /usr/include/linux/vt.h