Penguin
Blame: console_ioctls(4)
EditPageHistoryDiffInfoLikePages
Annotated edit history of console_ioctls(4) version 4, including all changes. View license author blame.
Rev Author # Line
1 perry 1 CONSOLE_IOCTLS
2 !!!CONSOLE_IOCTLS
3 NAME
4 DESCRIPTION
5 RETURN VALUES
6 ERRORS
7 WARNING
8 SEE ALSO
9 ----
10 !!NAME
11
12
13 console ioctl's- ioctl's for console terminal and virtual consoles
14 !!DESCRIPTION
15
16
17 __WARNING: If you use the following information you are
18 going to burn yourself.__
19
20
21 __WARNING: ioctl's are undocumented Linux internals, liable
22 to be changed without warning. Use POSIX functions where
23 available.__
24
25
26 The following Linux-peculiar __ioctl()__ requests are
27 supported. Each requires a third argument, assumed here to
28 be ''argp''.
29
30
31 __KDGETLED__
32
33
34 Get state of LEDs. ''argp'' points to a long int. The
35 lower three bits of ''*argp'' are set to the state of the
36 LEDs, as follows:
37
38
39 LED_CAP 0x04 caps lock led LEC_NUM 0x02 num lock led LED_SCR
40 0x01 scroll lock led
41
42
43 __KDSETLED__
44
45
46 Set the LEDs. The LEDs are set to correspond to the lower
47 three bits of ''argp''. However, if a higher order bit is
48 set, the LEDs revert to normal: displaying the state of the
49 keyboard functions of caps lock, num lock, and scroll
50 lock.
51
52
53 Before 1.1.54, the leds just reflected the state of the
54 corresponding keyboard flags, and KDGETLED/KDSETLED would
55 also change the keyboard flags. Since 1.1.54 the leds can be
56 made to display arbitrary information, but by default they
57 display the keyboard flags. The following two ioctl's are
58 used to access the keyboard flags.
59
60
61 __KDGKBLED__
62
63
3 perry 64 Get keyboard flags !CapsLock, !NumLock, !ScrollLock (not
1 perry 65 lights). ''argp'' points to a char which is set to the
66 flag state. The low order three bits (mask 0x7) get the
67 current flag state, and the low order bits of the next
68 nibble (mask 0x70) get the default flag state. (Since
69 1.1.54.)
70
71
72 __KDSKBLED__
73
74
3 perry 75 Set keyboard flags !CapsLock, !NumLock, !ScrollLock (not
1 perry 76 lights). ''argp'' has the desired flag state. The low
77 order three bits (mask 0x7) have the flag state, and the low
78 order bits of the next nibble (mask 0x70) have the default
79 flag state. (Since 1.1.54.)
80
81
82 __KDGKBTYPE__
83
84
85 Get keyboard type. This returns the value KB_101, defined as
86 0x02.
87
88
89 __KDADDIO__
90
91
92 Add I/O port as valid. Equivalent to
93 ioperm(arg,1,1).
94
95
96 __KDDELIO__
97
98
99 Delete I/O port as valid. Equivalent to
100 ioperm(arg,1,0).
101
102
103 __KDENABIO__
104
105
106 Enable I/O to video board. Equivalent to ioperm(0x3b4,
107 0x3df-0x3b4+1, 1).
108
109
110 __KDDISABIO__
111
112
113 Disable I/O to video board. Equivalent to ioperm(0x3b4,
114 0x3df-0x3b4+1, 0).
115
116
117 __KDSETMODE__
118
119
120 Set text/graphics mode. ''argp'' is one of
121 these:
122
123
124 KD_TEXT 0x00 KD_GRAPHICS 0x01
125
126
127 __KDGETMODE__
128
129
130 Get text/graphics mode. ''argp'' points to a long which
131 is set to one of the above values.
132
133
134 __KDMKTONE__
135
136
137 Generate tone of specified length. The lower 16 bits of
138 ''argp'' specify the period in clock cycles, and the
139 upper 16 bits give the duration in msec. If the duration is
140 zero, the sound is turned off. Control returns immediately.
141 For example, ''argp'' = (125
142 ''
143
144
145 __KIOCSOUND__
146
147
148 Start or stop sound generation. The lower 16 bits of
149 ''argp'' specify the period in clock cycles (that is,
150 ''argp'' = 1193180/frequency). ''argp'' = 0 turns
151 sound off. In either case, control returns
152 immediately.
153
154
155 __GIO_FONT__
156
157
158 Gets screen font in expanded form. ''argp'' points to an
159 8192 byte array.
160
161
162 __PIO_FONT__
163
164
165 Sets screen font. Load font into the EGA/VGA character
166 generator. ''argp'' points to a 8192 byte map, with 32
167 bytes per character. Only first ''N'' of them are used
168 for an 8x''N'' font (0 ''N''
169 ''
170
171
172 __GIO_SCRNMAP__
173
174
175 Get screen mapping from kernel. ''argp'' points to an
176 area of size E_TABSZ.
177
178
179 __PIO_SCRNMAP__
180
181
182 Loads the
183 argp'' points to an area of size E_TABSZ.
184
185
186 __GIO_UNIMAP__
187
188
189 Get unicode-to-font mapping from kernel. ''argp'' points
190 to a
191
192
193 struct unimapdesc {
194 u_short ''entry_ct'';
195 struct unipair *''entries'';
196 };
197 where ''entries'' points to an array of
198
199
200 struct unipair {
201 u_short ''unicode'';
202 u_short ''fontpos'';
203 };
204 (Since 1.1.92.)
205
206
207 __PIO_UNIMAP__
208
209
210 Put unicode-to-font mapping in kernel. ''argp'' points to
211 a struct unimapdesc. (Since 1.1.92)
212
213
214 __PIO_UNIMAPCLR__
215
216
217 Clear table, possibly advise hash algorithm. ''argp''
218 points to a
219
220
221 struct unimapinit {
222 u_short ''advised_hashsize''; /* 0 if no opinion */
223 u_short ''advised_hashstep''; /* 0 if no opinion */
224 u_short ''advised_hashlevel''; /* 0 if no opinion */
225 };
226 (Since 1.1.92.)
227
228
229 __KDGKBMODE__
230
231
232 Gets current keyboard mode. ''argp'' points to a long
233 which is set to one of these:
234
235
236 K_RAW 0x00 K_XLATE 0x01 K_MEDIUMRAW 0x02 K_UNICODE
237 0x03
238
239
240 __KDSKBMODE__
241
242
243 Sets current keyboard mode. ''argp'' is a long equal to
244 one of the above values.
245
246
247 __KDGKBMETA__
248
249
250 Gets meta key handling mode. ''argp'' points to a long
251 which is set to one of these:
252
253
254 K_METABIT 0x03 set high order bit K_ESCPREFIX 0x04 escape
255 prefix
256
257
258 __KDSKBMETA__
259
260
261 Sets meta key handling mode. ''argp'' is a long equal to
262 one of the above values.
263
264
265 __KDGKBENT__
266
267
268 Gets one entry in key translation table (keycode to action
269 code). ''argp'' points to a
270
271
272 struct kbentry {
273 u_char ''kb_table'';
274 u_char ''kb_index'';
275 u_short ''kb_value'';
276 };
277 with the first two members filled in: ''kb_table'' selects the key table (0 ''kb_table'' ''kb_index'' is the keycode (0 ''kb_index'' ''kb_value'' is set to the corresponding action code, or K_HOLE if there is no such key, or K_NOSUCHMAP if ''kb_table'' is invalid.
278
279
280 __KDSKBENT__
281
282
283 Sets one entry in translation table. ''argp'' points to a
284 struct kbentry.
285
286
287 __KDGKBSENT__
288
289
290 Gets one function key string. ''argp'' points to
291 a
292
293
294 struct kbsentry {
295 u_char ''kb_func'';
296 u_char ''kb_string''[[512];
297 };
298 ''kb_string'' is set to the (NULL terminated) string corresponding to the ''kb_func''th function key action code.
299
300
301 __KDSKBSENT__
302
303
304 Sets one function key string entry. ''argp'' points to a
305 struct kbsentry.
306
307
308 __KDGKBDIACR__
309
310
311 Read kernel accent table. ''argp'' points to
312 a
313
314
315 struct kbdiacrs {
316 unsigned int ''kb_cnt'';
317 struct kbdiacr ''kbdiacr''[[256];
318 };
319 where ''kb_cnt'' is the number of entries in the array, each of which is a
320
321
322 struct kbdiacr { u_char ''diacr'', ''base'',
323 ''result''; };
324
325
326 __KDGETKEYCODE__
327
328
329 Read kernel keycode table entry (scan code to keycode).
330 ''argp'' points to a
331
332
333 struct kbkeycode { unsigned int ''scancode'', ''keycode''; };
334 ''keycode'' is set to correspond to the given ''scancode''. (89 ''scancode'' ''scancode'' ''keycode''==''scancode''.) (Since 1.1.63.)
335
336
337 __KDSETKEYCODE__
338
339
340 Write kernel keycode table entry. ''argp'' points to
341 struct kbkeycode. (Since 1.1.63.)
342
343
344 __KDSIGACCEPT__
345
346
347 The calling process indicates its willingness to accept the
348 signal ''argp'' when it is generated by pressing an
349 appropriate key combination. (1 ''argp''
350 ''
351
352
353 __VT_OPENQRY__
354
355
356 Returns the first available (non-opened) console.
357 ''argp'' points to an int which is set to the number of
358 the vt (1 ''*argp''
359 ''
360
361
362 __VT_GETMODE__
363
364
365 Get mode of active vt. ''argp'' points to a
366
367
368 struct vt_mode {
369 char ''mode''; /* vt mode */
370 char ''waitv''; /* if set, hang on writes if not active */
371 short ''relsig''; /* signal to raise on release req */
372 short ''acqsig''; /* signal to raise on acquisition */
373 short ''frsig''; /* unused (set to 0) */
374 };
375 ''mode'' is set to one of these values:
376
377
378 VT_AUTO auto vt switching VT_PROCESS process controls
379 switching VT_ACKACQ acknowledge switch
380
381
382 __VT_SETMODE__
383
384
385 Set mode of active vt. ''argp'' points to a struct
386 vt_mode.
387
388
389 __VT_GETSTATE__
390
391
392 Get global vt state info. ''argp'' points to
393 a
394
395
396 struct vt_stat {
397 ushort ''v_active''; /* active vt */
398 ushort ''v_signal''; /* signal to send */
399 ushort ''v_state''; /* vt bitmask */
400 };
401 For each vt in use, the corresponding bit in the ''v_state'' member is set. (Kernels 1.0 through 1.1.92.)
402
403
404 __VT_RELDISP__
405
406
407 Release a display.
408
409
410 __VT_ACTIVATE__
411
412
413 Switch to vt ''argp'' (1 ''argp''
414 ''
415
416
417 __VT_WAITACTIVE__
418
419
420 Wait until vt ''argp'' has been activated.
421
422
423 __VT_DISALLOCATE__
424
425
426 Deallocate the memory associated with vt ''argp''. (Since
427 1.1.54.)
428
429
430 __VT_RESIZE__
431
432
433 Set kernel's idea of screensize. ''argp'' points to
434 a
435
436
437 struct vt_sizes {
438 ushort ''v_rows''; /* # rows */
439 ushort ''v_cols''; /* # columns */
440 ushort ''v_scrollsize''; /* no longer used */
441 };
442 (Since 1.1.54.) Note that this does not change the videomode. See resizecons(8).
443
444
445 The action of the following ioctls depends on the first byte
446 in the struct pointed to by ''argp'', referred to here as
447 the ''subcode''. These are legal only for the superuser
448 or the owner of the current tty.
449
450
451 __TIOCLINUX, subcode=0__
452
453
454 Dump the screen. Disappeared in 1.1.92. (With kernel 1.1.92
455 or later, read from /dev/vcsN or /dev/vcsaN
456 instead.)
457
458
459 __TIOCLINUX, subcode=1__
460
461
462 Get task information. Disappeared in 1.1.92.
463
464
465 __TIOCLINUX, subcode=2__
466
467
468 Set selection. ''argp'' points to a
469
470
471 struct {char ''subcode''; short ''xs'', ''ys'',
472 ''xe'', ''ye''; short ''sel_mode''; }
473
474
475 ''xs'' and ''ys'' are the starting column and row.
476 ''xe'' and ''ye'' are the ending column and row.
477 (Upper left corner is row=column=1.) ''sel_mode'' is 0
478 for character-by-character selection, 1 for word-by-word
479 selection, or 2 for line-by-line selection. The indicated
480 screen characters are highlighted and saved in the static
481 array sel_buffer in devices/char/console.c.
482
483
484 __TIOCLINUX, subcode=3__
485
486
487 Paste selection. The characters in the selection buffer are
488 written to ''fd''.
489
490
491 __TIOCLINUX, subcode=4__
492
493
494 Unblank the screen.
495
496
497 __TIOCLINUX, subcode=5__
498
499
500 Sets contents of a 256-bit look up table defining characters
501 in a
502
503
504 __TIOCLINUX, subcode=6__
505
506
507 ''argp'' points to a char which is set to the value of
508 the kernel variable ''shift_state''. (Since
509 1.1.32.)
510
511
512 __TIOCLINUX, subcode=7__
513
514
515 ''argp'' points to a char which is set to the value of
516 the kernel variable ''report_mouse''. (Since
517 1.1.33.)
518
519
520 __TIOCLINUX, subcode=8__
521
522
523 Dump screen width and height, cursor position, and all the
524 character-attribute pairs. (Kernels 1.1.67 through 1.1.91
525 only. With kernel 1.1.92 or later, read from /dev/vcsa*
526 instead.)
527
528
529 __TIOCLINUX, subcode=9__
530
531
532 Restore screen width and height, cursor position, and all
533 the character-attribute pairs. (Kernels 1.1.67 through
534 1.1.91 only. With kernel 1.1.92 or later, write to
535 /dev/vcsa* instead.)
536
537
538 __TIOCLINUX, subcode=10__
539
540
541 Handles the Power Saving feature of the new generation of
542 monitors. VESA screen blanking mode is set to ''argp'',
543 which is one of:
544
545
546 ''0'': Screen blanking is disabled.
547
548
549 ''1'': The current video adapter register settings are
550 saved, then the controller is programmed to turn off the
551 vertical synchronization pulses. This puts the monitor into
552 ''
553
554
555 ''2'': The current settings are saved, then both the
556 vertical and horizontal synchronization pulses are turned
557 off. This puts the monitor into
558 ''Caution:'' Powering
559 down frequently will damage the monitor.)
560
561
562 (Since 1.1.76.)
563 !!RETURN VALUES
564
565
566 -1 for error, and ''errno'' is set.
567 !!ERRORS
568
569
570 ''errno'' may take on these values:
571
572
573 EBADF file descriptor is invalid.
574 ENOTTY file descriptor is not associated with a character
575 special device, or the specified request does not
576 apply to it.
577 EINVAL file descriptor or ''argp'' is invalid.
578 EPERM permission violation.
579 !!WARNING
580
581
582 Do not regard this man page as documentation of the Linux
583 console ioctl's. This is provided for the curious only, as
584 an alternative to reading the source. Ioctl's are
585 undocumented Linux internals, liable to be changed without
586 warning. (And indeed, this page more or less describes the
587 situation as of kernel version 1.1.94; there are many minor
588 and not-so-minor differences with earlier
589 versions.)
590
591
592 Very often, ioctl's are introduced for communication between
593 the kernel and one particular well-known program
594 (fdisk(8), hdparm(8), setserial(8),
595 tunelp(8), loadkeys(1), gpm(8),
596 consolechars(8), etc.), and their behavior will be
597 changed when required by these particular
598 programs.
599
600
601 Programs using these ioctl's will not be portable to other
602 versions of Unix, will not work on older versions of Linux,
603 and will not work on future versions of Linux.
604
605
606 Use POSIX functions.
607 !!SEE ALSO
608
609
4 perry 610 kbd_mode(1), loadkeys(1), dumpkeys(1),
1 perry 611 mknod(1), setleds(1), setmetamode(1),
612 ioperm(2), termios(2), execve(2),
613 fcntl(2), mt(4), sd(4), tty(4),
614 ttys(4), vcs(4), vcsa(4),
615 mapscrn(8), consolechars(8),
616 resizecons(8), ''/usr/include/linux/kd.h'',
617 ''/usr/include/linux/vt.h''.
618 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.