.\" Copyright (c) 1995 James R. Van Zandt .\" Sat Feb 18 09:11:07 EST 1995 .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" Modified, Sun Feb 26 15:08:05 1995, faith@cs.unc.edu .\" 2007-12-17, Samuel Thibault : .\" document the VT_GETHIFONTMASK ioctl .\" " .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1996,1997,1998 ISHIKAWA Mutsumi .\" all rights reserved. .\" Translated Tue Feb 6 16:30:31 JST 1997 .\" by ISHIKAWA Mutsumi .\" Updated 2013-07-31, Akihiro MOTOKI .\" .TH VCS 4 2007\-12\-17 Linux "Linux Programmer's Manual" .SH 名前 vcs, vcsa \- 仮想コンソールメモリー (virtual console memory) .SH 説明 \fI/dev/vcs0\fP はメジャーナンバー (major number) 7、マイナーナンバー (minor number) 0 のキャラクターデバイス (character device) で、 通常、そのモードは 0644、オーナは root.tty である。 このデバイスファイル (device file) は 現在表示されている仮想コンソール端末のメモリーを参照する。 .LP \fB/dev/vcs[1\-63]\fP は仮想コンソール端末のための キャラクターデバイスで、メジャーナンバーが 7、マイナーナンバーが 1 から 63、 通常はモードが 0644、オーナーが root.tty である。 \fB/dev/vcsa[0\-63]\fP は \fB/dev/vcs[1\-63]\fP と同様であるが、 属性を格納するのに (ホストバイトオーダの) \fIunsigned short\fP を使用している点、スクリーンのサイズ・カーソルの位置を表す 4 バイトの情報 \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP (\fIx\fP =\fIy\fP = 0 が画面の左上) が先頭にある点が異なる。 512 文字から成るフォントをロードした場合、 9 ビット目の情報は \fI/dev/tty[1\-63]\fP に対して \fBioctl\fP(2) \fBVT_GETHIFONTMASK\fP 操作を行うことで取得できる (\fBVT_GETHIFONTMASK\fP 操作はカーネル 2.6.18 以降の Linux で 利用可能である)。 値は \fBioctl\fP(2) の 3 番目の引き数が指す \fIunsigned short\fP に格納されて返される。 .PP これらのデバイスは \fBconsole\fP(4) の screendump \fBioctl\fP(2) を代替となる。 従って、システム管理者はファイルシステムパーミッション (filesystem permission) を使ってアクセスをコントロールできる。 .PP 最初の 8 つの仮想端末のためのデバイスは、次のようにして作る事ができる: .nf 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* .fi \fBioctl\fP(2) による要求はサポートされない。 .SH ファイル /dev/vcs[0\-63] .br .\" .SH AUTHOR .\" Andries Brouwer /dev/vcsa[0\-63] .SH バージョン Linux カーネルバージョン 1.1.92 で導入された。 .SH 例 vt1 に移って以下を実行すると、vt3 のスクリーンダンプを取ることができます。 cat /dev/vcs3 >foo 主力には改行文字が含まれない点に注意して下さい。 そのため、 何らかの処理が必要となるかもしれません。 例えば、 old \-w 81 /dev/vcs3 | lpr (ひどい方法としては) xetterm \-dump 3 \-file /proc/self/fd/1 .LP \fI/dev/vcsa0\fP デバイスを使うことで、 ブライユ点字をサポートすることができる。 以下のプログラムは、 二つ目の仮想コンソールのカーソル位置のスクリーン属性と文字を表示した後、 カーソル位置の背景色を変更する。 .nf #include #include #include #include #include #include int main(void) { int fd; char *device = "/dev/vcsa2"; char *console = "/dev/tty2"; struct {unsigned char lines, cols, x, y;} scrn; unsigned short s; unsigned short mask; unsigned char ch, attrib; fd = open(console, O_RDWR); if (fd < 0) { perror(console); exit(EXIT_FAILURE); } if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) { perror("VT_GETHIFONTMASK"); exit(EXIT_FAILURE); } (void) close(fd); fd = open(device, O_RDWR); if (fd < 0) { perror(device); exit(EXIT_FAILURE); } (void) read(fd, &scrn, 4); (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0); (void) read(fd, &s, 2); ch = s & 0xff; if (attrib & mask) ch |= 0x100; attrib = ((s & ~mask) >> 8); printf("ch=\(aq%c\(aq attrib=0x%02x\en", ch, attrib); attrib ^= 0x10; (void) lseek(fd, \-1, 1); (void) write(fd, &attrib, 1); exit(EXIT_SUCCESS); } .fi .SH 関連項目 \fBconsole\fP(4), \fBtty\fP(4), \fBttyS\fP(4), \fBgpm\fP(8) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。