Examine or change the pathname prefix tree (QNX)
prefix [-A prefix=string] [-D prefix] [-n node_id] [-R prefix=string] [-s]
The pathname space is administered through the use of two forms of prefixes:
The prefix utility allows you to examine and modify the pathname prefix tree.
The prefix tree is essentially an in-memory pathname redirector that is maintained on each computer. When a file is opened, its pathname is matched against the prefix strings in order to direct the request to open the file to the appropriate I/O manager.
For example, the character device manager Dev registers the /dev prefix. Therefore, when a process calls open() with /dev/xxx, a prefix match of /dev will occur and the open() will be directed to Dev (the prefix's owner).
The form of an I/O manager prefix is as follows:
prefix=pid,unit
where pid is the process ID of the I/O resource manager and the unit number is a single character assigned by the I/O manager. For example, if Fsys is process 3 and Dev is process 5, then the prefix tree might appear as:
/=3,b /dev=5,a /dev/hd0=3,a /dev/hd0t77=3,d
Note that Fsys has registered three prefixes:
In cases where prefixes overlap, the longest match always wins. Therefore, in the example above, references to /dev/hd0 and /dev/hd0t77 are directed to Fsys rather than to Dev, while all other pathnames starting with /dev are still forwarded to Dev.
In addition to this absolute redirection to an I/O manager, another form of prefix, called an alias, lets you replace a matched prefix with a new prefix, which is then re-applied to the prefix tree. Unlike the I/O manager form of prefix, aliases can be modified using the prefix utility. An alias is of the form:
prefix=replacement_string
Aliases are often used to map remote resources into the local pathname space. For example, a diskless workstation might typically create an alias for its root (/) to a filesystem on another node:
prefix -A /=//10/
Aliases can also be used to create special device names. For example, the following command:
prefix -A /dev/console=//20/dev/con1
would alias /dev/console to the primary console on node 20.
The -A option adds a new prefix to the prefix tree. The prefix being added must not already be in the tree.
The -R option deletes, then adds, a prefix to the prefix tree.
The -D option deletes an existing prefix from the prefix tree.
List the prefix tree currently in effect:
prefix
List the prefix tree in effect on node 20:
prefix -n 20
Create prefix aliases for /home1=//10/home1 and /home2=//14/home2:
prefix -A /home1=//10/home1 -A /home2=//14/home2
Create a prefix alias for /dev/printer pointing to //12/dev/spool/text:
prefix -A /dev/printer=//12/dev/spool/text
Remove the prefix for /dev/printer:
prefix -D /dev/printer
Since redefining the prefix aliases affects all the processes on the computer, you should do this with caution, especially when dealing with definitions for root (/).
System Architecture