-->

Previous | Table of Contents | Next

Page 1099

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.
Example:

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);

MTIOCGET: Get status

This request takes an argument of type (struct mtget *). The driver returns an EIO error if the drive rejects an operation.


/* 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;

};

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).

mt_resid is always zero. (Not implemented for SCSI tape drives.)

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.

mt_gstat reports generic (device independent) status information. The header file defines macros for testing these status bits:

GMT_EOF(x) The tape is positioned just after a filemark (always false after an MTSEEK operation).
GMT_BOT(x) The tape is positioned at the beginning of the first file (always false after an MTSEEK operation).
GMT_EOT(x) A tape operation has reached the physical End of Tape.
GMT_SM(x) The tape is currently positioned at a setmark (always false after an MTSEEK operation).
GMT_EOD(x) The tape is positioned at the end of recorded data.
GMT_WR_PROT(x) The drive is write-protected. For some drives this can also mean that the drive does not support writing on the current medium type.
GMT_ONLINE(x) The last open() found the drive with a tape in place and ready for operation.
GMT_D_6250(x), GMT_D_1600(x), GMT_D_800(x) This generic status information reports the current density setting for 9-track tape drives only.
GMT_DR_OPEN(x) The drive does not have a tape in place.
GMT_IM_REP_EN(x) Immediate report mode (not supported).
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.

Page 1100

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).
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).

MTIOCPOS: Get tape position

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,…).


/* structure for MTIOCPOS - mag tape get position command */

struct mtpos {

long mt_blkno; /* current block number */

};

RETURN VALUE

EIO The requested operation could not be completed.
ENOSPC A write operation could not be completed because the tape reached end-of-medium.
EACCES An attempt was made to write or erase a write-protected tape. (This error is not detected during open().)
ENXIO During opening, the tape device does not exist.
EBUSY The device is already in use or the driver was unable to allocate a buffer.
EOVERFLOW An attempt was made to read or write a variable-length block that is larger than the driver's internal buffer.
EINVAL An ioctl() had an illegal argument, or a requested block size was illegal.
ENOSYS Unknown ioctl().

COPYRIGHT

Copyright 1995, Robert K. Nichols.

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.

SEE ALSO

mt(1)

Linux 1.1.86, 31 January 1995

tty

tty—Controlling terminal.

DESCRIPTION

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.

In addition to the ioctl() requests supported by the device that tty refers to, the following ioctl() request is supported:

Page 1101

TIOCNOTTY 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.

FILES


/dev/tty

SEE ALSO


mknod(1), chown(1), getty(1), termios(2), console(4), ttys(4)

Linux, 21 January 1992

ttys

ttys—Serial terminal lines.

DESCRIPTION

ttyS[0-3] are character devices for the serial terminal lines.

They are typically created by


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]

FILES


/dev/ttyS[0-3]

SEE ALSO


mknod(1), chown(1), getty(1), tty(4)

Linux, 19 December 1992

vcs, vcsa

vcs, vcsa—Virtual console memory.

DESCRIPTION

/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.

/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.)

Previous | Table of Contents | Next