-->

Previous | Table of Contents | Next

Page 1102

These replace the screendump ioctls of console(4), so the system administrator can control access using filesystem permissions.

The devices for the first eight virtual consoles may be created by


for x in 0 1 2 3 4 5 6 7 8; do

mknod -m 644 /dev/vcs$x c 7 $x;

mknod -m 644 /dev/vcsa$x c 7 $[$x+128];

done

chown root.tty /dev/vcs*

No ioctl() requests are supported.

EXAMPLES

You can do a screendump on vt3 by switching to vt1 and typing cat /dev/vcs3 >foo.

This program displays the character and screen attributes under the cursor of the second virtual console and then changes the background color there:


#include <unistd.h>

#include <stdio.h>

#include <fcntl.h>



void main()

{ int fd;

    struct {char lines, cols, x, y;} scrn;

    char ch, attrib;



    fd = open("/dev/vcsa2", O_RDWR);

    (void)read(fd, &scrn, 4);

    (void)lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);

    (void)read(fd, &ch, 1);

    (void)read(fd, &attrib, 1);

    printf("ch='%c' attrib=0x%02x\n", ch, attrib);

    attrib ^= 0x10;

    (void)lseek(fd, -1, 1);

    (void)write(fd, &attrib, 1);

}

FILES


/dev/vcs[0-63]

/dev/vcsa[0-63]

AUTHOR

Andries Brouwer (aeb@cwi.nl)

HISTORY

Introduced with version 1.1.92 of the Linux kernel.

SEE ALSO

console(4), tty(4), ttys(4), selection(1)

Linux, 19 February 1995

Previous | Table of Contents | Next