📄 1102-1102.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Complete Command Reference:Special Files:EarthWeb Inc.-</TITLE>
</HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311046 //-->
<!-- TITLE=Linux Complete Command Reference//-->
<!-- AUTHOR=Red Hat//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=04 //-->
<!-- PAGES=1063-1102 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="1099-1101.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch05/1103-1106.html">Next</A></CENTER></P>
<A NAME="PAGENUM-1102"><P>Page 1102</P></A>
<P>These replace the screendump ioctls of console(4), so the system administrator can control access using filesystem
permissions.
</P>
<P>The devices for the first eight virtual consoles may be created by
</P>
<!-- CODE SNIP //-->
<PRE>
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*
</PRE>
<!-- END CODE SNIP //-->
<P>No ioctl() requests are supported.
</P>
<P><B>
EXAMPLES
</B></P>
<P>You can do a screendump on vt3 by switching to vt1 and typing
cat /dev/vcs3 >foo.
</P>
<P>This program displays the character and screen attributes under the cursor of the second virtual console and then changes
the background color there:
</P>
<!-- CODE //-->
<PRE>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
void 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);
}
</PRE>
<!-- END CODE //-->
<P><B>
FILES
</B></P>
<!-- CODE SNIP //-->
<PRE>
/dev/vcs[0-63]
/dev/vcsa[0-63]
</PRE>
<!-- END CODE SNIP //-->
<P><B>
AUTHOR
</B></P>
<P>Andries Brouwer (aeb@cwi.nl)
</P>
<P><B>
HISTORY
</B></P>
<P>Introduced with version 1.1.92 of the Linux kernel.
</P>
<P><B>
SEE ALSO
</B></P>
<P>console(4), tty(4), ttys(4), selection(1)
</P>
<P>Linux, 19 February 1995
</P>
<P><CENTER>
<a href="1099-1101.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch05/1103-1106.html">Next</A></CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -