vcs

Autres langues

Langue: ja

Version: 1995-02-19 (openSuse - 09/10/07)

Section: 4 (Pilotes et protocoles réseau)

̾Á°

vcs, vcsa - ²¾ÁÛ¥³¥ó¥½¡¼¥ë¥á¥â¥ê (virtual console memory)

ÀâÌÀ

/dev/vcs0 ¤Ï¥á¥¸¥ã¡¼¥Ê¥ó¥Ð¡¼ (major number) 7¡¢¥Þ¥¤¥Ê¡¼¥Ê¥ó¥Ð¡¼ (minor number) 0 ¤Î¥­¥ã¥é¥¯¥¿¡¼¥Ç¥Ð¥¤¥¹ (character device) ¤Ç¡¢ Ä̾¤½¤Î¥â¡¼¥É¤Ï 0644¡¢¥ª¡¼¥Ê¤Ï root.tty ¤Ç¤¢¤ë¡£ ¤³¤Î¥Ç¥Ð¥¤¥¹¥Õ¥¡¥¤¥ë (device file) ¤Ï ¸½ºßɽ¼¨¤µ¤ì¤Æ¤¤¤ë²¾ÁÛ¥³¥ó¥½¡¼¥ëüËö¤Î¥á¥â¥ê¤ò»²¾È¤¹¤ë¡£

/dev/vcs[1-63] ¤Ï²¾ÁÛ¥³¥ó¥½¡¼¥ëüËö¤Î¤¿¤á¤Î ¥­¥ã¥é¥¯¥¿¡¼¥Ç¥Ð¥¤¥¹¤Ç¡¢¥á¥¸¥ã¡¼¥Ê¥ó¥Ð¡¼¤¬ 7¡¢¥Þ¥¤¥Ê¡¼¥Ê¥ó¥Ð¡¼¤¬ 1 ¤«¤é 63¡¢ Ä̾ï¤Ï¥â¡¼¥É¤¬ 0644¡¢¥ª¡¼¥Ê¡¼¤¬ root.tty ¤Ç¤¢¤ë¡£ /dev/vcsa[0-63] ¤Ï /dev/vcs[1-63] ¤ÈƱÍͤǤ¢¤ë¤¬¡¢ °À­¤ò´Þ¤ó¤Ç¤¤¤ëÅÀ¡¢¥¹¥¯¥ê¡¼¥ó¤Î¥µ¥¤¥º¡¦¥«¡¼¥½¥ë¤Î°ÌÃÖ¤òɽ¤¹ 4 ¥Ð¥¤¥È¤Î¾ðÊó lines, columns,x, y (x =y = 0 ¤¬²èÌ̤κ¸¾å) ¤¬ÀèƬ¤Ë¤¢¤ëÅÀ¤¬°Û¤Ê¤ë¡£

¤³¤ì¤é¤Ï console(4) ¤Î screendump ioctl ¤òÂåÂؤȤʤ롣 ½¾¤Ã¤Æ¡¢¥·¥¹¥Æ¥à´ÉÍý¼Ô¤Ï¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó (filesystem permission) ¤ò»È¤Ã¤Æ¥¢¥¯¥»¥¹¤ò¥³¥ó¥È¥í¡¼¥ë¤Ç¤­¤ë¡£

ºÇ½é¤Î 8 ¤Ä¤Î²¾ÁÛüËö¤Î¤¿¤á¤Î¥Ç¥Ð¥¤¥¹¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Æºî¤ë»ö¤¬¤Ç¤­¤ë:


    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*

ioctl(2) ¤Ë¤è¤ëÍ×µá¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¤¡£

¥Õ¥¡¥¤¥ë

/dev/vcs[0-63]
/dev/vcsa[0-63]

Ãø¼Ô

Andries Brouwer <aeb@cwi.nl>

¥Ð¡¼¥¸¥ç¥ó

Linux ¥«¡¼¥Í¥ë¥Ð¡¼¥¸¥ç¥ó 1.1.92 ¤ÇƳÆþ¤µ¤ì¤¿¡£

Îã

vt3 ¤Î¥¹¥¯¥ê¡¼¥ó¥À¥ó¥×¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢Ã¼Ëö¤ò vt1 ¤ËÀÚÂؤ¨¤Æ cat /dev/vcs3 >foo ¤È¥¿¥¤¥×¤¹¤ì¤Ð¤è¤¤¡£ µ¤¤òÉÕ¤±¤ÆÍߤ·¤¤¤Î¤Ï¡¢¤³¤Î½ÐÎϤϲþ¹Ôʸ»ú (newline character) ¤ò ´Þ¤ó¤Ç¤¤¤Ê¤¤¤È¤¤¤¦»ö¤Ç¤¢¤ë¡£ ½¾¤Ã¤Æ¡¢fold -w 81 /dev/vcs3 | lpr ¤ä (¤¾¤Ã¤È¤¹¤ë¤¬) setterm -dump 3 -file /proc/self/fd/1 ¤Î¤è¤¦¤Ê ²¿¤é¤«¤Î½èÍý¤¬É¬Íפˤʤ뤫¤â¤·¤ì¤Ê¤¤¡£

/dev/vcsa0 ¥Ç¥Ð¥¤¥¹¤ò»È¤¦¤³¤È¤Ç¡¢ ¥Ö¥é¥¤¥æÅÀ»ú¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£

°Ê²¼¤Î¥×¥í¥°¥é¥à¤ÏÆó¤ÄÌܤβ¾ÁÛ¥³¥ó¥½¡¼¥ë¤Î¥«¡¼¥½¥ë°ÌÃ֤Υ¹¥¯¥ê¡¼¥ó°À­¤Èʸ»ú ¤òɽ¼¨¤·¤¿¸å¡¢¥«¡¼¥½¥ë°ÌÃÖ¤ÎÇØ·Ê¿§¤òÊѹ¹¤¹¤ë :


#include <unistd.h>

#include <stdlib.h>

#include <stdio.h>

#include <fcntl.h>



int

main(void)

{

    int fd;

    char *device = "/dev/vcsa2";

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

    char ch, attrib;



    fd = open(device, O_RDWR);

    if (fd < 0) {

        perror(device);

        exit(1);

    }

    (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);

    exit(EXIT_SUCCESS);

}

´ØÏ¢¹àÌÜ

gpm(8), console(4), tty(4), ttyS(4)

ËÝÌõ¼Ô

ÀÐÀî ËÓ <ishikawa@linux.or.jp>