OSDN Git Service

360a88c4d2738b312fcfe01ce2bde02fd7b66adf
[linuxjm/LDP_man-pages.git] / draft / man4 / vcs.4
1 .\" Copyright (c) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" Sat Feb 18 09:11:07 EST 1995
3 .\"
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified, Sun Feb 26 15:08:05 1995, faith@cs.unc.edu
26 .\" 2007-12-17, Samuel Thibault <samuel.thibault@ens-lyon.org>:
27 .\"     document the VT_GETHIFONTMASK ioctl
28 .\" "
29 .\"*******************************************************************
30 .\"
31 .\" This file was generated with po4a. Translate the source file.
32 .\"
33 .\"*******************************************************************
34 .\"
35 .\" Japanese Version Copyright (c) 1996,1997,1998 ISHIKAWA Mutsumi
36 .\"         all rights reserved.
37 .\" Translated Tue Feb 6 16:30:31 JST 1997
38 .\"         by ISHIKAWA Mutsumi <ishikawa@linux.or.jp>
39 .\" Updated 2013-07-31, Akihiro MOTOKI <amotoki@gmail.com>
40 .\"
41 .TH VCS 4 2007\-12\-17 Linux "Linux Programmer's Manual"
42 .SH 名前
43 vcs, vcsa \- 仮想コンソールメモリ (virtual console memory)
44 .SH 説明
45 \fI/dev/vcs0\fP はメジャーナンバー (major number) 7、マイナーナンバー (minor number) 0
46 のキャラクターデバイス (character device) で、 通常、そのモードは 0644、オーナは root.tty である。
47 このデバイスファイル (device file) は 現在表示されている仮想コンソール端末のメモリを参照する。
48 .LP
49 \fB/dev/vcs[1\-63]\fP は仮想コンソール端末のための キャラクターデバイスで、メジャーナンバーが 7、マイナーナンバーが 1 から 63、
50 通常はモードが 0644、オーナーが root.tty である。 \fB/dev/vcsa[0\-63]\fP は \fB/dev/vcs[1\-63]\fP
51 と同様であるが、 属性を格納するのに (ホストバイトオーダの)  \fIunsigned short\fP
52 を使用している点、スクリーンのサイズ・カーソルの位置を表す 4 バイトの情報 \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP
53 (\fIx\fP =\fIy\fP = 0 が画面の左上) が先頭にある点が異なる。
54
55 512 文字から成るフォントをロードした場合、 9 ビット目の情報は \fI/dev/tty[1\-63]\fP に対して \fBioctl\fP(2)
56 \fBVT_GETHIFONTMASK\fP 操作を行うことで取得できる (\fBVT_GETHIFONTMASK\fP 操作はカーネル 2.6.18 以降の
57 Linux で 利用可能である)。 値は \fBioctl\fP(2)  の 3 番目の引き数が指す \fIunsigned short\fP
58 に格納されて返される。
59 .PP
60 These devices replace the screendump \fBioctl\fP(2)  operations of
61 \fBconsole\fP(4), so the system administrator can control access using
62 filesystem permissions.
63 .PP
64 最初の 8 つの仮想端末のためのデバイスは、次のようにして作る事ができる:
65
66 .nf
67     for x in 0 1 2 3 4 5 6 7 8; do
68         mknod \-m 644 /dev/vcs$x c 7 $x;
69         mknod \-m 644 /dev/vcsa$x c 7 $[$x+128];
70     done
71     chown root:tty /dev/vcs*
72 .fi
73
74 \fBioctl\fP(2)  による要求はサポートされない。
75 .SH ファイル
76 /dev/vcs[0\-63]
77 .br
78 .\" .SH AUTHOR
79 .\" Andries Brouwer <aeb@cwi.nl>
80 /dev/vcsa[0\-63]
81 .SH バージョン
82 Linux カーネルバージョン 1.1.92 で導入された。
83 .SH 例
84 vt1 に移って以下を実行すると、vt3 のスクリーンダンプを取ることができます。
85
86     cat /dev/vcs3 >foo
87
88 主力には改行文字が含まれない点に注意して下さい。 そのため、 何らかの処理が必要となるかもしれません。 例えば、
89
90     old \-w 81 /dev/vcs3 | lpr
91
92 (ひどい方法としては)
93
94     xetterm \-dump 3 \-file /proc/self/fd/1
95
96 .LP
97 \fI/dev/vcsa0\fP デバイスを使うことで、 ブライユ点字をサポートすることができる。
98
99 以下のプログラムは、 二つ目の仮想コンソールのカーソル位置のスクリーン属性と文字を表示した後、 カーソル位置の背景色を変更する。
100
101 .nf
102 #include <unistd.h>
103 #include <stdlib.h>
104 #include <stdio.h>
105 #include <fcntl.h>
106 #include <sys/ioctl.h>
107 #include <linux/vt.h>
108
109 int
110 main(void)
111 {
112     int fd;
113     char *device = "/dev/vcsa2";
114     char *console = "/dev/tty2";
115     struct {unsigned char lines, cols, x, y;} scrn;
116     unsigned short s;
117     unsigned short mask;
118     unsigned char ch, attrib;
119
120     fd = open(console, O_RDWR);
121     if (fd < 0) {
122         perror(console);
123         exit(EXIT_FAILURE);
124     }
125     if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
126         perror("VT_GETHIFONTMASK");
127         exit(EXIT_FAILURE);
128     }
129     (void) close(fd);
130     fd = open(device, O_RDWR);
131     if (fd < 0) {
132         perror(device);
133         exit(EXIT_FAILURE);
134     }
135     (void) read(fd, &scrn, 4);
136     (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
137     (void) read(fd, &s, 2);
138     ch = s & 0xff;
139     if (attrib & mask)
140         ch |= 0x100;
141     attrib = ((s & ~mask) >> 8);
142     printf("ch=\(aq%c\(aq attrib=0x%02x\en", ch, attrib);
143     attrib ^= 0x10;
144     (void) lseek(fd, \-1, 1);
145     (void) write(fd, &attrib, 1);
146     exit(EXIT_SUCCESS);
147 }
148 .fi
149 .SH 関連項目
150 \fBconsole\fP(4), \fBtty\fP(4), \fBttyS\fP(4), \fBgpm\fP(8)
151 .SH この文書について
152 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
153 である。プロジェクトの説明とバグ報告に関する情報は
154 http://www.kernel.org/doc/man\-pages/ に書かれている。