1 .\" Copyright (c) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" Sat Feb 18 09:11:07 EST 1995
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\" Modified, Sun Feb 26 15:08:05 1995, faith@cs.unc.edu
7 .\" 2007-12-17, Samuel Thibault <samuel.thibault@ens-lyon.org>:
8 .\" document the VT_GETHIFONTMASK ioctl
10 .TH vcs 4 (date) "Linux man-pages (unreleased)"
12 vcs, vcsa \- virtual console memory
15 is a character device with major number 7 and minor number
16 0, usually with mode 0644 and ownership root:tty.
17 It refers to the memory of the currently
18 displayed virtual console terminal.
21 are character devices for virtual console
22 terminals, they have major number 7 and minor number 1 to 63, usually
23 mode 0644 and ownership root:tty.
27 .IR "unsigned short" s
28 (in host byte order) that include attributes,
29 and prefixed with four bytes giving the screen
30 dimensions and cursor position:
38 = 0 at the top left corner of the screen.)
40 When a 512-character font is loaded,
41 the 9th bit position can be fetched by applying the
45 (available in Linux kernels 2.6.18 and above)
48 the value is returned in the
50 pointed to by the third
54 These devices replace the screendump
57 .BR ioctl_console (2),
59 administrator can control access using filesystem permissions.
61 The devices for the first eight virtual consoles may be created by:
65 for x in 0 1 2 3 4 5 6 7 8; do
66 mknod \-m 644 /dev/vcs$x c 7 $x;
67 mknod \-m 644 /dev/vcsa$x c 7 $[$x+128];
69 chown root:tty /dev/vcs*
75 requests are supported.
81 .\" Andries Brouwer <aeb@cwi.nl>
83 Introduced with version 1.1.92 of the Linux kernel.
85 You may do a screendump on vt3 by switching to vt1 and typing
93 Note that the output does not contain
94 newline characters, so some processing may be required, like
99 fold \-w 81 /dev/vcs3 | lpr
107 setterm \-dump 3 \-file /proc/self/fd/1
113 device is used for Braille support.
115 This program displays the character and screen attributes under the
116 cursor of the second virtual console, then changes the background color
124 #include <sys/ioctl.h>
125 #include <linux/vt.h>
131 char *device = "/dev/vcsa2";
132 char *console = "/dev/tty2";
133 struct {unsigned char lines, cols, x, y;} scrn;
136 unsigned char attrib;
139 fd = open(console, O_RDWR);
144 if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
145 perror("VT_GETHIFONTMASK");
149 fd = open(device, O_RDWR);
154 (void) read(fd, &scrn, 4);
155 (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), SEEK_SET);
156 (void) read(fd, &s, 2);
160 attrib = ((s & \(timask) >> 8);
161 printf("ch=%#03x attrib=%#02x\en", ch, attrib);
163 (void) lseek(fd, \-2, SEEK_CUR);
164 (void) write(fd, &s, 2);
169 .BR ioctl_console (2),