📄 1099-1101.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="1097-1098.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1102-1102.html">Next</A></CENTER></P>
<A NAME="PAGENUM-1099"><P>Page 1099</P></A>
<TABLE>
<TR><TD>
</TD><TD>
to lose track of the current file number normally returned by the
MTIOCGET request. If MT_ST_FAST_EOM is false, the driver will respond to an
MTEOM request by forward spacing over files.
</TD></TR><TR><TD>
</TD><TD>
Example:
</TD></TR><TR><TD>
</TD><TD>
<!-- CODE //-->
<PRE>
struct mtop mt_cmd;
mt_cmd.mt_op = MTSETDRVBUFFER;
mt_cmd.mt_count =MT_ST_BOOLEANS |
MT_ST_BUFFER_WRITES |
MT_ST_ASYNC_WRITES;
ioctl(fd, MTIOCTOP, &mt_cmd);
</PRE>
<!-- END CODE //-->
</TD></TR></TABLE>
<P><B>
MTIOCGET: Get status
</B></P>
<P>This request takes an argument of type (struct mtget
*). The driver returns an EIO error if the drive rejects an operation.
</P>
<!-- CODE //-->
<PRE>
/* structure for MTIOCGET - mag tape get status command */
struct mtget {
long mt_type;
long mt_resid;
/* the following registers are device dependent */
long mt_dsreg;
long mt_gstat;
long mt_erreg;
/* The next two fields are not always used */
daddr_t mt_fileno;
daddr_t mt_blkno;
};
</PRE>
<!-- END CODE //-->
<P>The header file defines many values for mt_type, but the current driver reports only the generic types
MT_ISSCSI1 (Generic SCSI-1 tape) and MT_ISSCSI2 (Generic SCSI-2 tape).
</P>
<P>mt_resid is always zero. (Not implemented for SCSI tape drives.)
</P>
<P>mt_dsreg reports the drive's current settings for block size (in the low 24 bits) and density (in the high 8 bits). These fields
are defined by MT_ST_BLKSIZE_SHIFT,
MT_ST_BLKSIZE_MASK, MT_ST_DENSITY_SHIFT, and
MT_ST_DENSITY_MASK.
</P>
<P>mt_gstat reports generic (device independent) status information. The header file defines macros for testing these status bits:
</P>
<TABLE>
<TR><TD>
GMT_EOF(x)
</TD><TD>
The tape is positioned just after a filemark (always false after an
MTSEEK operation).
</TD></TR><TR><TD>
GMT_BOT(x)
</TD><TD>
The tape is positioned at the beginning of the first file (always false
after an MTSEEK operation).
</TD></TR><TR><TD>
GMT_EOT(x)
</TD><TD>
A tape operation has reached the physical End of Tape.
</TD></TR><TR><TD>
GMT_SM(x)
</TD><TD>
The tape is currently positioned at a setmark (always false after an
MTSEEK operation).
</TD></TR><TR><TD>
GMT_EOD(x)
</TD><TD>
The tape is positioned at the end of recorded data.
</TD></TR><TR><TD>
GMT_WR_PROT(x)
</TD><TD>
The drive is write-protected. For some drives this can also mean that
the drive does not support writing on the current medium type.
</TD></TR><TR><TD>
GMT_ONLINE(x)
</TD><TD>
The last open() found the drive with a tape in place and ready
for operation.
</TD></TR><TR><TD>
GMT_D_6250(x), GMT_D_1600(x), GMT_D_800(x)
</TD><TD>
This generic status information reports the current density setting for
9-track tape drives only.
</TD></TR><TR><TD>
GMT_DR_OPEN(x)
</TD><TD>
The drive does not have a tape in place.
</TD></TR><TR><TD>
GMT_IM_REP_EN(x)
</TD><TD>
Immediate report mode (not supported).
</TD></TR><TR><TD>
</TD><TD>
mt_erreg: The only field defined in
mt_erreg is the recovered error
count in the low 16 bits (as defined by
MT_ST_SOFTERR_SHIFT and MT_ST_SOFTERR_MASK). Due to inconsistencies in the way drives
report recovered errors, this count is often not maintained.
</TD></TR></TABLE>
<A NAME="PAGENUM-1100"><P>Page 1100</P></A>
<TABLE>
<TR><TD>
</TD><TD>
mt_fileno reports the current file number (zero-based). This value is set
to -1 when the file number is unknown (such as after
MTBSS or MTSEEK).
</TD></TR><TR><TD>
</TD><TD>
mt_blkno reports the block number (zero-based) within the current
file. This value is set to -1 when the block number is unknown (such as
after MTBSF, MTBSS, or MTSEEK).
</TD></TR></TABLE>
<P><B>
MTIOCPOS: Get tape position
</B></P>
<P>This request takes an argument of type (struct mtpos
*) and reports the drive's notion of the current tape block
number, which is not the same as mt_blkno returned by
MTIOCGET. This drive must be a SCSI-2 drive that supports the
READ POSITION command (device-specific address) or a Tandberg-compatible SCSI-1 drive (Tandberg, Archive Viper, Wangtek,…).
</P>
<!-- CODE SNIP //-->
<PRE>
/* structure for MTIOCPOS - mag tape get position command */
struct mtpos {
long mt_blkno; /* current block number */
};
</PRE>
<!-- END CODE SNIP //-->
<P><B>
RETURN VALUE
</B></P>
<TABLE>
<TR><TD>
EIO
</TD><TD>
The requested operation could not be completed.
</TD></TR><TR><TD>
ENOSPC
</TD><TD>
A write operation could not be completed because the tape reached
end-of-medium.
</TD></TR><TR><TD>
EACCES
</TD><TD>
An attempt was made to write or erase a write-protected tape. (This
error is not detected during open().)
</TD></TR><TR><TD>
ENXIO
</TD><TD>
During opening, the tape device does not exist.
</TD></TR><TR><TD>
EBUSY
</TD><TD>
The device is already in use or the driver was unable to allocate a buffer.
</TD></TR><TR><TD>
EOVERFLOW
</TD><TD>
An attempt was made to read or write a variable-length block that
is larger than the driver's internal buffer.
</TD></TR><TR><TD>
EINVAL
</TD><TD>
An ioctl() had an illegal argument, or a requested block size was illegal.
</TD></TR><TR><TD>
ENOSYS
</TD><TD>
Unknown ioctl().
</TD></TR></TABLE>
<P><B>
COPYRIGHT
</B></P>
<P>Copyright 1995, Robert K. Nichols.
</P>
<P>Permission is granted to make and distribute verbatim copies of this manual, provided the copyright notice and
this permission notice are preserved on all copies. Additional permissions are contained in the header of the source file.
</P>
<P><B>
SEE ALSO
</B></P>
<P>mt(1)
</P>
<P>Linux 1.1.86, 31 January 1995
</P>
<H3><A NAME="ch04_ 17">
tty
</A></H3>
<P>tty—Controlling terminal.
</P>
<P><B>
DESCRIPTION
</B></P>
<P>The file /dev/tty is a character file with major number 5 and minor number 0, usually of mode 0666 and
owner.group root.tty. It is a synonym for the controlling terminal of a process, if any.
</P>
<P>In addition to the ioctl() requests supported by the device that
tty refers to, the following ioctl() request is supported:
</P>
<A NAME="PAGENUM-1101"><P>Page 1101</P></A>
<TABLE>
<TR><TD>
TIOCNOTTY
</TD><TD>
Detach the current process from its controlling terminal and remove
it from its current process group, without attaching it to a new
process group (that is, set its process group ID to zero). This
ioctl() call only works on file descriptors connected to
/dev/tty; this is used by daemon processes when they are invoked by a user at a terminal. The
process attempts to open /dev/tty; if the open succeeds, it detaches itself from
the terminal by using TIOCNOTTY, but if the open fails, it is obviously
not attached to a terminal and does not need to detach itself.
</TD></TR></TABLE>
<P><B>
FILES
</B></P>
<!-- CODE SNIP //-->
<PRE>
/dev/tty
</PRE>
<!-- END CODE SNIP //-->
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
mknod(1), chown(1), getty(1), termios(2), console(4), ttys(4)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux, 21 January 1992
</P>
<H3><A NAME="ch04_ 18">
ttys
</A></H3>
<P>ttys—Serial terminal lines.
</P>
<P><B>
DESCRIPTION
</B></P>
<P>ttyS[0-3] are character devices for the serial terminal lines.
</P>
<P>They are typically created by
</P>
<!-- CODE //-->
<PRE>
mknod -m 660 /dev/ttyS0 c 4 64 # base address 0x03f8
mknod -m 660 /dev/ttyS1 c 4 65 # base address 0x02f8
mknod -m 660 /dev/ttyS2 c 4 66 # base address 0x03e8
mknod -m 660 /dev/ttyS3 c 4 67 # base address 0x02e8
chown root.tty /dev/ttyS[0-3]
</PRE>
<!-- END CODE //-->
<P><B>
FILES
</B></P>
<!-- CODE SNIP //-->
<PRE>
/dev/ttyS[0-3]
</PRE>
<!-- END CODE SNIP //-->
<P><B>
SEE ALSO
</B></P>
<!-- CODE SNIP //-->
<PRE>
mknod(1), chown(1), getty(1), tty(4)
</PRE>
<!-- END CODE SNIP //-->
<P>Linux, 19 December 1992
</P>
<H3><A NAME="ch04_ 19">
vcs, vcsa
</A></H3>
<P>vcs, vcsa—Virtual console memory.
</P>
<P><B>
DESCRIPTION
</B></P>
<P>/dev/vcs0 is a character device with major number 7 and minor number 0, usually of mode 0644 and owner
root.tty. It refers to the memory of the currently displayed virtual console terminal.
</P>
<P>/dev/vcs[1-63] are character devices for virtual console terminals; they have major number 7 and minor number 1 to
63, usually mode 0644 and owner root.tty.
/dev/vcsa[0-63] are the same but include attributes and are prefixed with four
bytes, giving the screen dimensions and cursor position:
lines, columns, x, y.(x = y = 0 at the top-left corner of the screen.)
</P>
<P><CENTER>
<a href="1097-1098.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1102-1102.html">Next</A></CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -