|
|||||||
|
|
VCSSection: Linux Programmer's Manual (4)Updated: February 19, 1995 Index Return to Main Contents ̾Á°vcs, vcsa - ²¾ÁÛ¥³¥ó¥½¡¼¥ë¥á¥â¥ê (virtual console memory)ÀâÌÀ/dev/vcs0 ¤Ï¥á¥¸¥ã¡¼¥Ê¥ó¥Ð¡¼ (major number) 7¡¢¥Þ¥¤¥Ê¡¼¥Ê¥ó¥Ð¡¼ (minor number) 0 ¤Ç¡¢ÉáÄ̤ϥ⡼¥É 0644¡¢¥ª¡¼¥Ê¡¼root.tty ¤Î ¥¥ã¥é¥¯¥¿¡¼¥Ç¥Ð¥¤¥¹ (character device) ¤Ç¤¢¤ë¡£ ¤³¤Î¥Ç¥Ð¥¤¥¹¥Õ¥¡¥¤¥ë (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() ¤Ë¤è¤ëÍ×µá¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¤¡£ Îãvt1 ¤ËÀÚÂØ¤¨¤Æ vt3 ¤Î¥¹¥¯¥ê¡¼¥ó¥À¥ó¥×¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢ cat /dev/vcs3 >foo ¤È¥¿¥¤¥×¤¹¤ì¤Ð¤è¤¤¡£ µ¤¤òÉÕ¤±¤ÆÍߤ·¤¤¤Î¤Ï¡¢¤³¤Î½ÐÎϤϲþ¹Ôʸ»ú¤ò´Þ¤ó¤Ç¤¤¤Ê¤¤¤È¤¤¤¦»ö¤Ç¤¢¤ë¡£ ½¾¤Ã¤Æ¡¢fold -w 81 /dev/vcs3 | lpr ¤ä (¤¾¤Ã¤È¤¹¤ë¤¬) setterm -dump 3 -file /proc/self/fd/1 ¤Î¤è¤¦¤Ê ²¿¤é¤«¤Î½èÍý¤¬Í׵ᤵ¤ì¤ë¡£/dev/vcsa0 ¥Ç¥Ð¥¤¥¹¤Ï¡¢¥Ö¥é¥¤¥æÅÀ»ú¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤¿¤á¤Ë»È¤ï¤ì¤ë¡£ °Ê²¼¤Î¥×¥í¥°¥é¥à¤ÏÂèÆó²¾ÁÛ¥³¥ó¥½¡¼¥ë¤Î¥«¡¼¥½¥ë¤Î²¼¤Î¥¹¥¯¥ê¡¼¥ó°À¤Èʸ»ú ¤òɽ¼¨¤·¡¢¼¡¤Ë¤½¤³¤ÎÇØ·Ê¿§¤òÊѹ¹¤¹¤ë¡£:
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
int 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);
return 0;
}
¥Õ¥¡¥¤¥ë/dev/vcs[0-63]/dev/vcsa[0-63] Ãø¼ÔAndries Brouwer <aeb@cwi.nl>ÍúÎòLinux ¥«¡¼¥Í¥ë¥Ð¡¼¥¸¥ç¥ó 1.1.92 ¤ÇƳÆþ¤µ¤ì¤¿¡£´ØÏ¢¹àÌÜconsole(4), tty(4), ttys(4), selection(1)ËÝÌõ¼ÔÀÐÀî ËÓ <ishikawa@linux.or.jp>
Index | ||||||
|
|
|
Home :: Copyright :: Privacy :: Credits :: Get a free Linuxinfor Email Account Document on this page is part of "Linuxinfor Man Pages in HTML Format: man4". See Index Page for more info about Authorship and Copyright. 1999-2008 Linuxinfor.com. No rights reserved. |