Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ttysrch(4) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ttyname(3C)

clone(7)

ttysrch(4)                                                       ttysrch(4)

NAME
     ttysrch - directory search list for ttyname

DESCRIPTION
     ttysrch is an optional file that is used by the ttyname(3C) library
     routine. This file contains the names of files and directories in /dev
     that contain terminal and terminal-related device files. The purpose
     of this file is to improve the performance of ttyname by indicating
     which files and subdirectories in /dev contain terminal-related device
     files and should be searched first. These file and subdirectory names
     must appear on separate lines and must begin with /dev. Those path
     names that do not begin with /dev will be ignored and a warning will
     be sent to the console. Blank lines (lines containing only white
     space) and lines beginning with the comment character "#" will be
     ignored. For each file listed (except for the special entry /dev),
     ttyname will recursively search through subdirectories looking for a
     match. If /dev appears in the ttysrch file, the /dev directory itself
     will be searched but there will not be a recursive search through its
     subdirectories.

     When ttyname searches through the device files, it tries to find a
     file whose major/minor device number, file system identifier, and
     inode number match that of the file descriptor it was given as an
     argument. If a match is not found, it will settle for a match of just
     major/minor device and file system identifier, if one can be found.
     However, if the file descriptor is associated with a cloned device
     [see clone(7)], this algorithm does not work efficiently because the
     inode number of the device file associated with a clonable device will
     never match the inode number of the file descriptor that was returned
     by the open of that clonable device. To help with these situations,
     entries can be put into the /etc/ttysrch file to improve performance
     when cloned devices are used as terminals on a system (e.g. for remote
     login). However, this is only useful if the minor devices related to a
     cloned device are put into a subdirectory. (It is important to note
     that device files need not exist for cloned devices and if that is the
     case, ttyname will eventually fail.) For example if /dev/tcp is a
     cloned device, there could be a subdirectory /dev/tcp that contains
     files 0, 1, 2, etc. that correspond to the minor devices of the star-
     lan driver. An optional second field is used in the /etc/ttysrch file
     to indicate the matching criteria. This field is separated by white
     space (any combination of blanks or tabs). The letter M means
     major/minor device number, F means file system identifier, and I means
     inode number.

     The following options (letters) are not standard in UNIX V5.4, but may
     be used to increase the performance of ttyname.

     The f option provides for rapid access to inodes. It can be used to
     accelerate searching for an inode, being particularly useful on sys-
     tems with a large number of terminals or pseudo-tty devices. Caution:
     If the f option is set, subdirectories are not searched recursively.




Page 1                       Reliant UNIX 5.44                Printed 11/98

ttysrch(4)                                                       ttysrch(4)

     The letter X specifies that this particular directory should not be
     searched for a match.

     The letter N specifies that a major device number follows as argument.
     The allows one to specify which major numbers occur in a particular
     directory. The letter N and the following major device number argument
     may occur more than once in the line, thereby specifying more than
     major device number for a particular directory. If the major number of
     the file descriptor passed to ttyname matches any of those specified
     with the N option, then ttyname searches that directory first looking
     for a match. This improves the performance of ttyname by pointing it
     to the directory which it should search first.

     The letter P specifies that a device name pattern follows as argument.
     This allows one to specify how the names of the files in the directory
     will be formed for the testing done by ttyname.

     In order to avoid having to check each file separately in a directory,
     ttyname first attempts to check the filename entry with a matching
     minor device number to that passed to ttyname. In order to do that
     though, ttyname needs to know what the filenames in the directory look
     like. ttyname has default patterns which it uses, but the letter P may
     be used to specify these patterns. The specified pattern must contain
     %d somewhere within it. The %d portion is then replaced by the minor
     device number. As in the printf function, a field width may also be
     specified, for example, %3d. With the /etc/ttysrch entry

          /dev/term P tty%3d

     and assuming a minor device number of 20, the name argument used by
     ttyname for its testing would be /dev/term/tty020.

     The letter E specifies that the entry is a file and not a directory.

     If no option is specified for an entry, the default is MFI which means
     try to match on all three. For cloned devices the field should be MF,
     which indicates that it is not necessary to match on the inode number.

     Without the /etc/ttysrch file, ttyname will search the /dev directory
     by first looking in the directories /dev/term, /dev/pts, and /dev/xt.
     If a system has terminal devices installed in directories other than
     these, it may help performance if the ttysrch file is created and con-
     tains that list of directories.











Page 2                       Reliant UNIX 5.44                Printed 11/98

ttysrch(4)                                                       ttysrch(4)

EXAMPLE
     A sample /etc/ttysrch file follows:

     /dev/term/ttyc0 MFE
     /dev/inet MFN 29 P %d N 30
     /dev/term fIP tty%3d
     /dev/pts  MFI
     /dev/xt   MFI
     /dev/slan MF

     This file tells ttyname that it should first search through those
     directories listed and that when searching through the /dev/slan
     directory, if a file is encountered whose major/minor devices and file
     system identifier match that of the file descriptor argument to
     ttyname, this device name should be considered a match.

     When /dev/term is searched, ttyname only compares the inodes. The sub-
     directories of /dev/term are not searched recursively.

FILES
     /etc/ttysrch

SEE ALSO
     ttyname(3C), clone(7).






























Page 3                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026