1ttysrch(4) File Formats ttysrch(4)
2
3
4
6 ttysrch - directory search list for ttyname
7
9 ttysrch is an optional file that is used by the ttyname library rou‐
10 tine. This file contains the names of directories in /dev that contain
11 terminal and terminal-related device files. The purpose of this file is
12 to improve the performance of ttyname by indicating which subdirecto‐
13 ries in /dev contain terminal-related device files and should be
14 searched first. These subdirectory names must appear on separate lines
15 and must begin with /dev. Those path names that do not begin with /dev
16 will be ignored and a warning will be sent to the console. Blank lines
17 (lines containing only white space) and lines beginning with the com‐
18 ment character "#" will be ignored. For each file listed (except for
19 the special entry /dev), ttyname will recursively search through subdi‐
20 rectories looking for a match. If /dev appears in the ttysrch file, the
21 /dev directory itself will be searched but there will not be a recur‐
22 sive search through its subdirectories.
23
24
25 When ttyname searches through the device files, it tries to find a file
26 whose major/minor device number, file system identifier, and inode num‐
27 ber match that of the file descriptor it was given as an argument. If a
28 match is not found, it will settle for a match of just major/minor
29 device and file system identifier, if one can be found. However, if the
30 file descriptor is associated with a cloned device, this algorithm does
31 not work efficiently because the inode number of the device file asso‐
32 ciated with a clonable device will never match the inode number of the
33 file descriptor that was returned by the open of that clonable device.
34 To help with these situations, entries can be put into the /etc/ttysrch
35 file to improve performance when cloned devices are used as terminals
36 on a system (for example, for remote login). However, this is only use‐
37 ful if the minor devices related to a cloned device are put into a sub‐
38 directory. (It is important to note that device files need not exist
39 for cloned devices and if that is the case, ttyname will eventually
40 fail.) An optional second field is used in the /etc/ttysrch file to
41 indicate the matching criteria. This field is separated by white space
42 (any combination of blanks or tabs). The letter M means major/minor
43 device number, F means file system identifier, and I means inode num‐
44 ber. If this field is not specified for an entry, the default is MFI
45 which means try to match on all three. For cloned devices the field
46 should be MF, which indicates that it is not necessary to match on the
47 inode number.
48
49
50 Without the /etc/ttysrch file, ttyname will search the /dev directory
51 by first looking in the directories /dev/term, /dev/pts, and /dev/xt.
52 If a system has terminal devices installed in directories other than
53 these, it may help performance if the ttysrch file is created and con‐
54 tains that list of directories.
55
57 Example 1 A sample display of /etc/ttysrch command.
58
59
60 A sample /etc/ttysrch file follows:
61
62
63 /dev/term MFI
64 /dev/pts MFI
65 /dev/xt MFI
66 /dev/slan MF
67
68
69
70
71 This file tells ttyname that it should first search through those
72 directories listed and that when searching through the /dev/slan
73 directory, if a file is encountered whose major/minor devices and file
74 system identifier match that of the file descriptor argument to tty‐
75 name, this device name should be considered a match.
76
77
79 /etc/ttysrch
80
81
83 ttyname(3C)
84
85
86
87SunOS 5.11 23 Feb 1994 ttysrch(4)