OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[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 .\" 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.
8 .\"
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.
13 .\"
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.
18 .\"
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,
22 .\" USA.
23 .\"
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
27 .\" "
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>
32 .\"
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
38 .\"
39 .\" WORD:       virtual console         ²¾ÁÛ¥³¥ó¥½¡¼¥ë
40 .\" WORD:       memory                  ¥á¥â¥ê
41 .\" WORD:       permission              ¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó
42 .\" WORD:       prefix                  ¥×¥ì¥Õ¥£¥Ã¥¯¥¹
43 .\" WORD:       screen                  ¥¹¥¯¥ê¡¼¥ó
44 .\" WORD:       cursor                  ¥«¡¼¥½¥ë
45 .\" WORD:       Braille                 ¥Ö¥é¥¤¥æÅÀ»ú
46 .\"
47 .TH VCS 4 2007-12-17 "Linux" "Linux Programmer's Manual"
48 .\"O .SH NAME
49 .SH Ì¾Á°
50 .\"O vcs, vcsa \- virtual console memory
51 vcs, vcsa \- ²¾ÁÛ¥³¥ó¥½¡¼¥ë¥á¥â¥ê (virtual console memory)
52 .\"O .SH DESCRIPTION
53 .SH ÀâÌÀ
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 ¸½ºßɽ¼¨¤µ¤ì¤Æ¤¤¤ë²¾ÁÛ¥³¥ó¥½¡¼¥ëüËö¤Î¥á¥â¥ê¤ò»²¾È¤¹¤ë¡£
63 .LP
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
68 .\"O using
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 °À­¤ò³ÊǼ¤¹¤ë¤Î¤Ë (¥Û¥¹¥È¥Ð¥¤¥È¥ª¡¼¥À¤Î)
79 .I "unsigned short"
80 ¤ò»ÈÍѤ·¤Æ¤¤¤ëÅÀ¡¢¥¹¥¯¥ê¡¼¥ó¤Î¥µ¥¤¥º¡¦¥«¡¼¥½¥ë¤Î°ÌÃÖ¤òɽ¤¹
81 4 ¥Ð¥¤¥È¤Î¾ðÊó
82 \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP
83 (\fIx\fP =\fIy\fP = 0 ¤¬²èÌ̤κ¸¾å) ¤¬ÀèƬ¤Ë¤¢¤ëÅÀ¤¬°Û¤Ê¤ë¡£
84
85 .\"O When a 512-character font is loaded,
86 .\"O the 9th bit position can be fetched by applying the
87 .\"O .BR ioctl (2)
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
94 .\"O .BR ioctl (2)
95 .\"O argument.
96 512 Ê¸»ú¤«¤éÀ®¤ë¥Õ¥©¥ó¥È¤ò¥í¡¼¥É¤·¤¿¾ì¹ç¡¢
97 9 ¥Ó¥Ã¥ÈÌܤξðÊó¤Ï \fI/dev/tty[1\-63]\fP ¤ËÂФ·¤Æ
98 .BR ioctl (2)
99 \fBVT_GETHIFONTMASK\fP Áàºî¤ò¹Ô¤¦¤³¤È¤Ç¼èÆÀ¤Ç¤­¤ë
100 (\fBVT_GETHIFONTMASK\fP Áàºî¤Ï¥«¡¼¥Í¥ë 2.6.18 °Ê¹ß¤Î Linux ¤Ç
101 ÍøÍѲÄǽ¤Ç¤¢¤ë)¡£
102 ÃͤÏ
103 .BR ioctl (2)
104 ¤Î 3 ÈÖÌܤΰú¤­¿ô¤¬»Ø¤¹
105 .I "unsigned short"
106 ¤Ë³ÊǼ¤µ¤ì¤ÆÊÖ¤µ¤ì¤ë¡£
107 .PP
108 .\"O These devices replace the screendump
109 .\"O .BR ioctl (2)
110 .\"O operations of
111 .\"O .BR console (4),
112 .\"O so the system
113 .\"O administrator can control access using file system permissions.
114 ¤³¤ì¤é¤Î¥Ç¥Ð¥¤¥¹¤Ï
115 .BR console (4)
116 ¤Î screendump
117 .BR ioctl (2)
118 ¤òÂåÂؤȤʤ롣
119 ½¾¤Ã¤Æ¡¢¥·¥¹¥Æ¥à´ÉÍý¼Ô¤Ï¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó
120 (filesystem permission) ¤ò»È¤Ã¤Æ¥¢¥¯¥»¥¹¤ò¥³¥ó¥È¥í¡¼¥ë¤Ç¤­¤ë¡£
121 .PP
122 .\"O The devices for the first eight virtual consoles may be created by:
123 ºÇ½é¤Î 8 ¤Ä¤Î²¾ÁÛüËö¤Î¤¿¤á¤Î¥Ç¥Ð¥¤¥¹¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Æºî¤ë»ö¤¬¤Ç¤­¤ë:
124
125 .nf
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];
129     done
130     chown root:tty /dev/vcs*
131 .fi
132
133 .\"O No
134 .\"O .BR ioctl (2)
135 .\"O requests are supported.
136 .BR ioctl (2)
137 ¤Ë¤è¤ëÍ×µá¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¤¡£
138 .\"O .SH FILES
139 .SH ¥Õ¥¡¥¤¥ë
140 /dev/vcs[0\-63]
141 .br
142 /dev/vcsa[0\-63]
143 .\"O .\" .SH AUTHOR
144 .\" .SH Ãø¼Ô
145 .\" Andries Brouwer <aeb@cwi.nl>
146 .\"O .SH VERSIONS
147 .SH ¥Ð¡¼¥¸¥ç¥ó
148 .\"O Introduced with version 1.1.92 of the Linux kernel.
149 Linux ¥«¡¼¥Í¥ë¥Ð¡¼¥¸¥ç¥ó 1.1.92 ¤ÇƳÆþ¤µ¤ì¤¿¡£
150 .\"O .SH EXAMPLE
151 .SH Îã
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) ¤ò
161 ´Þ¤ó¤Ç¤¤¤Ê¤¤¤È¤¤¤¦»ö¤Ç¤¢¤ë¡£
162 ½¾¤Ã¤Æ¡¢\fIfold \-w 81 /dev/vcs3 | lpr\fP ¤ä
163 (¤¾¤Ã¤È¤¹¤ë¤¬) \fIsetterm \-dump 3 \-file /proc/self/fd/1\fP ¤Î¤è¤¦¤Ê
164 ²¿¤é¤«¤Î½èÍý¤¬É¬Íפˤʤ뤫¤â¤·¤ì¤Ê¤¤¡£
165 .LP
166 .\"O The \fI/dev/vcsa0\fP device is used for Braille support.
167 \fI/dev/vcsa0\fP ¥Ç¥Ð¥¤¥¹¤ò»È¤¦¤³¤È¤Ç¡¢
168 ¥Ö¥é¥¤¥æÅÀ»ú¤ò¥µ¥Ý¡¼¥È¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
169
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
172 .\"O there:
173 °Ê²¼¤Î¥×¥í¥°¥é¥à¤ÏÆó¤ÄÌܤβ¾ÁÛ¥³¥ó¥½¡¼¥ë¤Î¥«¡¼¥½¥ë°ÌÃ֤Υ¹¥¯¥ê¡¼¥ó°À­¤Èʸ»ú
174 ¤òɽ¼¨¤·¤¿¸å¡¢¥«¡¼¥½¥ë°ÌÃÖ¤ÎÇØ·Ê¿§¤òÊѹ¹¤¹¤ë :
175
176 .nf
177 #include <unistd.h>
178 #include <stdlib.h>
179 #include <stdio.h>
180 #include <fcntl.h>
181 #include <sys/ioctl.h>
182 #include <linux/vt.h>
183
184 int
185 main(void)
186 {
187     int fd;
188     char *device = "/dev/vcsa2";
189     char *console = "/dev/tty2";
190     struct {unsigned char lines, cols, x, y;} scrn;
191     unsigned short s;
192     unsigned short mask;
193     unsigned char ch, attrib;
194
195     fd = open(console, O_RDWR);
196     if (fd < 0) {
197         perror(console);
198         exit(EXIT_FAILURE);
199     }
200     if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
201         perror("VT_GETHIFONTMASK");
202         exit(EXIT_FAILURE);
203     }
204     (void) close(fd);
205     fd = open(device, O_RDWR);
206     if (fd < 0) {
207         perror(device);
208         exit(EXIT_FAILURE);
209     }
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);
213     ch = s & 0xff;
214     if (attrib & mask)
215         ch |= 0x100;
216     attrib = ((s & ~mask) >> 8);
217     printf("ch=\(aq%c\(aq attrib=0x%02x\\n", ch, attrib);
218     attrib ^= 0x10;
219     (void) lseek(fd, \-1, 1);
220     (void) write(fd, &attrib, 1);
221     exit(EXIT_SUCCESS);
222 }
223 .fi
224 .\"O .SH "SEE ALSO"
225 .SH ´ØÏ¢¹àÌÜ
226 .BR console (4),
227 .BR tty (4),
228 .BR ttyS (4),
229 .BR gpm (8)