MOUNT_PORTAL(8) | System Manager's Manual | MOUNT_PORTAL(8) |
mount_portal | [-o options] /etc/portal.conf mount_point |
The options are as follows:
The portal daemon provides an open service. Objects opened under the portal mount point are dynamically created by the portal daemon according to rules specified in the named configuration file. Using this mechanism allows descriptors such as sockets to be made available in the filesystem namespace.
The portal daemon works by being passed the full pathname of the object being opened. The daemon creates an appropriate descriptor according to the rules in the configuration file, and then passes the descriptor back to the calling process as the result of the open system call.
Currently, four sub-namespaces are implemented: tcp, fs, rfilter and wfilter. The tcp namespace takes a hostname and a port (slash separated) and creates an open TCP/IP connection. The fs namespace opens the named file, starting back at the root directory. This can be used to provide a controlled escape path from a chrooted environment.
The rfilter and wfilter namespaces open a pipe to a process, typically a data-filter such as compression or decompression programs. The rfilter namespace opens a read-only pipe, while the wfilter namespace opens a write-only pipe. See the EXAMPLES section below for more examples.
The first field is a pathname prefix to match against the requested pathname. If a match is found, the second field tells the daemon what type of object to create. Subsequent fields are passed to the creation function.
The rfilter and wfilter namespaces have additional meanings for the remaining fields. The third field specifies a prefix that is to be stripped off of the passed name before passing it on to the pipe program. If the prefix does not match, no stripping is performed. The fourth argument specifies the program to use for the pipe. Any remaining fields are passed to the pipe program. If the string “%s
” exists within these remaining fields, it will be replaced by the path after stripping is performed. If there is no field after the program name, “%s
” will be assumed, to maintain similarity with the tcp and fs namespaces.
# @(#)portal.conf 5.1 (Berkeley) 7/13/92 tcp/ tcp tcp/ fs/ file fs/ echo/ rfilter echo/ echo %s echo_nostrip/ rfilter nostrip echo %s echo_noslash rfilter echo_noslash echo %s gzcat/ rfilter gzcat/ gzcat %s gzip/ wfilter gzip/ gzip > %s gzip9/ wfilter gzip9/ gzip -9 > %s ftp/ rfilter ftp/ ftp -Vo - %s ftp:// rfilter nostrip ftp -Vo - %s http:// rfilter nostrip ftp -Vo - %s bzcat/ rfilter bzcat/ bzcat %s nroff/ rfilter nroff/ nroff -man %s
As is true with many other filesystems, a weird sense of humor is handy.
Notice that after the keynames, like nroff/ and bzcat/, we typically use another slash. In reality, the mount_portal process changes directory to /, which makes the subsequent slash unnecessary. However, the extra slash provides a visual hint that we are not operating on an ordinary file. An alternative would be to change the configuration file to something like:
nroff% rfilter nroff% nroff -man
One might then use
less /p/nroff%/usr/share/man/man8/mount_portal.8
December 5, 2009 | NetBSD 6.1 |