1 .\" Copyright (c) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" Sat Feb 18 09:11:07 EST 1995
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
24 .\" Modified, Sun Feb 26 15:08:05 1995, faith@cs.unc.edu
25 .\" 2007-12-17, Samuel Thibault <samuel.thibault@ens-lyon.org>:
26 .\" document the VT_GETHIFONTMASK ioctl
28 .\" Japanese Version Copyright (c) 1996,1997,1998 ISHIKAWA Mutsumi
29 .\" all rights reserved.
30 .\" Translated Tue Feb 6 16:30:31 JST 1997
31 .\" by ISHIKAWA Mutsumi <ishikawa@linux.or.jp>
33 .\" Japanese Version Last Modified Sun Jan 11 03:55:54 1998
34 .\" by ISHIKAWA Mutsumi <ishikawa@linux.or.jp>
35 .\" Updated Sat Feb 10 23:17:30 JST 2001
36 .\" by Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
37 .\" Updated 2008-02-12, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.77
39 .\" WORD: virtual console 仮想コンソール
41 .\" WORD: permission パーミッション
42 .\" WORD: prefix プレフィックス
43 .\" WORD: screen スクリーン
45 .\" WORD: Braille ブライユ点字
47 .TH VCS 4 2007-12-17 "Linux" "Linux Programmer's Manual"
50 .\"O vcs, vcsa \- virtual console memory
51 vcs, vcsa \- 仮想コンソールメモリ (virtual console memory)
54 .\"O \fI/dev/vcs0\fP is a character device with major number 7 and minor number
55 .\"O 0, usually of mode 0644 and owner root.tty.
56 .\"O It refers to the memory of the currently
57 .\"O displayed virtual console terminal.
58 \fI/dev/vcs0\fP はメジャーナンバー (major number) 7、マイナーナンバー
59 (minor number) 0 のキャラクターデバイス (character device) で、
60 通常、そのモードは 0644、オーナは root.tty である。
61 このデバイスファイル (device file) は
62 現在表示されている仮想コンソール端末のメモリを参照する。
64 .\"O \fI/dev/vcs[1\-63]\fP are character devices for virtual console
65 .\"O terminals, they have major number 7 and minor number 1 to 63, usually
66 .\"O mode 0644 and owner root.tty.
67 .\"O \fI/dev/vcsa[0\-63]\fP are the same, but
69 .\"O .IR "unsigned short" s
70 .\"O (in host byte order) that include attributes,
71 .\"O and prefixed with four bytes giving the screen
72 .\"O dimensions and cursor position: \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP.
73 .\"O (\fIx\fP = \fIy\fP = 0 at the top left corner of the screen.)
74 \fB/dev/vcs[1\-63]\fP は仮想コンソール端末のための
75 キャラクターデバイスで、メジャーナンバーが 7、マイナーナンバーが 1 から 63、
76 通常はモードが 0644、オーナーが root.tty である。
77 \fB/dev/vcsa[0\-63]\fP は \fB/dev/vcs[1\-63]\fP と同様であるが、
78 属性を格納するのに (ホストバイトオーダの)
80 を使用している点、スクリーンのサイズ・カーソルの位置を表す
82 \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP
83 (\fIx\fP =\fIy\fP = 0 が画面の左上) が先頭にある点が異なる。
85 .\"O When a 512-character font is loaded,
86 .\"O the 9th bit position can be fetched by applying the
88 .\"O \fBVT_GETHIFONTMASK\fP operation
89 .\"O (available in Linux kernels 2.6.18 and above)
90 .\"O on \fI/dev/tty[1\-63]\fP;
91 .\"O the value is returned in the
92 .\"O .I "unsigned short"
93 .\"O pointed to by the third
96 512 文字から成るフォントをロードした場合、
97 9 ビット目の情報は \fI/dev/tty[1\-63]\fP に対して
99 \fBVT_GETHIFONTMASK\fP 操作を行うことで取得できる
100 (\fBVT_GETHIFONTMASK\fP 操作はカーネル 2.6.18 以降の Linux で
108 .\"O These devices replace the screendump
111 .\"O .BR console (4),
113 .\"O administrator can control access using file system permissions.
119 従って、システム管理者はファイルシステムパーミッション
120 (filesystem permission) を使ってアクセスをコントロールできる。
122 .\"O The devices for the first eight virtual consoles may be created by:
123 最初の 8 つの仮想端末のためのデバイスは、次のようにして作る事ができる:
126 for x in 0 1 2 3 4 5 6 7 8; do
127 mknod \-m 644 /dev/vcs$x c 7 $x;
128 mknod \-m 644 /dev/vcsa$x c 7 $[$x+128];
130 chown root:tty /dev/vcs*
135 .\"O requests are supported.
145 .\" Andries Brouwer <aeb@cwi.nl>
148 .\"O Introduced with version 1.1.92 of the Linux kernel.
149 Linux カーネルバージョン 1.1.92 で導入された。
152 .\"O You may do a screendump on vt3 by switching to vt1 and typing
153 .\"O \fIcat /dev/vcs3 >foo\fP.
154 .\"O Note that the output does not contain
155 .\"O newline characters, so some processing may be required, like
156 .\"O in \fIfold \-w 81 /dev/vcs3 | lpr\fP or (horrors)
157 .\"O \fIsetterm \-dump 3 \-file /proc/self/fd/1\fP.
158 vt3 のスクリーンダンプを実行するには、端末を vt1 に切替えて
159 \fIcat /dev/vcs3 >foo\fP とタイプすればよい。
160 気を付けて欲しいのは、この出力は改行文字 (newline character) を
162 従って、\fIfold \-w 81 /dev/vcs3 | lpr\fP や
163 (ぞっとするが) \fIsetterm \-dump 3 \-file /proc/self/fd/1\fP のような
166 .\"O The \fI/dev/vcsa0\fP device is used for Braille support.
167 \fI/dev/vcsa0\fP デバイスを使うことで、
170 .\"O This program displays the character and screen attributes under the
171 .\"O cursor of the second virtual console, then changes the background color
173 以下のプログラムは二つ目の仮想コンソールのカーソル位置のスクリーン属性と文字
174 を表示した後、カーソル位置の背景色を変更する :
181 #include <sys/ioctl.h>
182 #include <linux/vt.h>
188 char *device = "/dev/vcsa2";
189 char *console = "/dev/tty2";
190 struct {unsigned char lines, cols, x, y;} scrn;
193 unsigned char ch, attrib;
195 fd = open(console, O_RDWR);
200 if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
201 perror("VT_GETHIFONTMASK");
205 fd = open(device, O_RDWR);
210 (void) read(fd, &scrn, 4);
211 (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
212 (void) read(fd, &s, 2);
216 attrib = ((s & ~mask) >> 8);
217 printf("ch=\(aq%c\(aq attrib=0x%02x\\n", ch, attrib);
219 (void) lseek(fd, \-1, 1);
220 (void) write(fd, &attrib, 1);