Lexical file names in plan 9 or getting dot-dot right

Robert N. Pike · 2000

Symbolic links make the Unix file system non-hierarchical, resulting in multiple valid path names for a given file. This ambiguity is a source of confusion, especially since some shells work overtime to present a con sistent view from programs such as pwd, while other programs and the kernel itself do nothing about the problem. Plan 9 has no symbolic links but it does have other mechanisms that pro duce the same difficulty. Moreover, Plan 9 is founded on the ability to control a programs environment by manipulating its name space. Ambiguous names muddle the result of operations such as copying a name space across the network. To address these problems, the Plan 9 kernel has been modified to main tain an accurate path name for every active file (open file, working direc tory, mount table entry) in the system. The definition of accurate is that the path name for a file is guaranteed to be the rooted, absolute name the program used to acquire it. These names are maintained by an effi cient method that combines lexical processingsuch as evaluating.. by just removing the last path name element of a directorywith local oper ations within the file system to maintain a consistently, easily understood view of the name system. Ambiguous situations are resolved by examin ing the lexically maintained names themselves. A new kernel call, fd2path, returns the file name associated with an open file, permitting the use of reliable names to improve system ser vices ranging from pwd to debugging. Although this work was done in Plan 9, Unix systems could also benefit from the addition of a method to recover the accurate name of an open file or the current directory.

Read the paper · More papers on PaperTik