1VCS(4)                     Linux Programmer's Manual                    VCS(4)
2
3
4

NAME

6       vcs, vcsa - virtual console memory
7

DESCRIPTION

9       /dev/vcs0 is a character device with major number 7 and minor number 0,
10       usually of mode 0644 and owner root.tty.  It refers to  the  memory  of
11       the currently displayed virtual console terminal.
12
13       /dev/vcs[1-63]  are  character  devices  for virtual console terminals,
14       they have major number 7 and minor number 1 to 63,  usually  mode  0644
15       and  owner  root.tty.   /dev/vcsa[0-63]  are  the  same,  but including
16       attributes, and prefixed with four bytes giving the  screen  dimensions
17       and  cursor position: lines, columns, x, y.  (x = y = 0 at the top left
18       corner of the screen.)
19
20       These replace the screendump ioctls of console(4), so the system admin‐
21       istrator can control access using file system permissions.
22
23       The devices for the first eight virtual consoles may be created by:
24
25           for x in 0 1 2 3 4 5 6 7 8; do
26               mknod -m 644 /dev/vcs$x c 7 $x;
27               mknod -m 644 /dev/vcsa$x c 7 $[$x+128];
28           done
29           chown root:tty /dev/vcs*
30
31       No ioctl() requests are supported.
32

EXAMPLE

34       You  may  do  a  screendump  on  vt3 by switching to vt1 and typing cat
35       /dev/vcs3 >foo. Note that the output does not contain  newline  charac‐
36       ters,  so some processing may be required, like in fold -w 81 /dev/vcs3
37       | lpr or (horrors) setterm -dump 3 -file /proc/self/fd/1.
38
39       The /dev/vcsa0 device is used for Braille support.
40
41       This program displays the character and  screen  attributes  under  the
42       cursor of the second virtual console, then changes the background color
43       there:
44
45           #include <unistd.h>
46           #include <stdlib.h>
47           #include <stdio.h>
48           #include <fcntl.h>
49
50           int main() {
51               int fd;
52               char *device = "/dev/vcsa2";
53               struct {unsigned char lines, cols, x, y;} scrn;
54               char ch, attrib;
55
56               fd = open(device, O_RDWR);
57               if (fd < 0) {
58                   perror(device);
59                   exit(1);
60               }
61               (void) read(fd, &scrn, 4);
62               (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
63               (void) read(fd, &ch, 1);
64               (void) read(fd, &attrib, 1);
65               printf("ch='%c' attrib=0x%02x\n", ch, attrib);
66               attrib ^= 0x10;
67               (void) lseek(fd, -1, 1);
68               (void) write(fd, &attrib, 1);
69               return 0;
70           }
71
72

FILES

74       /dev/vcs[0-63]
75       /dev/vcsa[0-63]
76

AUTHOR

78       Andries Brouwer <aeb@cwi.nl>
79

HISTORY

81       Introduced with version 1.1.92 of the Linux kernel.
82

SEE ALSO

84       gpm(8), console(4), tty(4), ttyS(4)
85
86
87
88Linux                             1995-02-19                            VCS(4)
Impressum