1.\" $NetBSD: mount_portal.8,v 1.17 2002/10/01 13:52:49 wiz Exp $ 2.\" 3.\" Copyright (c) 1993, 1994 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software donated to Berkeley by 7.\" Jan-Simon Pendry. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the University of 20.\" California, Berkeley and its contributors. 21.\" 4. Neither the name of the University nor the names of its contributors 22.\" may be used to endorse or promote products derived from this software 23.\" without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35.\" SUCH DAMAGE. 36.\" 37.\" @(#)mount_portal.8 8.3 (Berkeley) 3/27/94 38.\" 39.Dd March 27, 1994 40.Dt MOUNT_PORTAL 8 41.Os 42.Sh NAME 43.Nm mount_portal 44.Nd mount the portal daemon 45.Sh SYNOPSIS 46.Nm "" 47.Op Fl o Ar options 48.Ar /etc/portal.conf 49.Ar mount_point 50.Sh DESCRIPTION 51The 52.Nm 53command attaches an instance of the portal daemon 54to the global filesystem namespace. 55The conventional mount point is 56.Pa /p . 57This command is normally executed by 58.Xr mount 8 59at boot time. 60.Pp 61The options are as follows: 62.Bl -tag -width indent 63.It Fl o 64Options are specified with a 65.Fl o 66flag followed by a comma separated string of options. 67See the 68.Xr mount 8 69man page for possible options and their meanings. 70.El 71.Pp 72The portal daemon provides an 73.Em open 74service. 75Objects opened under the portal mount point are 76dynamically created by the portal daemon according 77to rules specified in the named configuration file. 78Using this mechanism allows descriptors such as sockets 79to be made available in the filesystem namespace. 80.Pp 81The portal daemon works by being passed the full pathname 82of the object being opened. 83The daemon creates an appropriate descriptor according 84to the rules in the configuration file, and then passes the descriptor back 85to the calling process as the result of the open system call. 86.Sh NAMESPACE 87By convention, the portal daemon divides the namespace into sub-namespaces, 88each of which handles objects of a particular type. 89.Pp 90Currently, four sub-namespaces are implemented: 91.Pa tcp , 92.Pa fs , 93.Pa rfilter 94and 95.Pa wfilter . 96The 97.Pa tcp 98namespace takes a hostname and a port (slash separated) and 99creates an open TCP/IP connection. 100The 101.Pa fs 102namespace opens the named file, starting back at the root directory. 103This can be used to provide a controlled escape path from 104a chrooted environment. 105.Pp 106The 107.Pa rfilter 108and 109.Pa wfilter 110namespaces open a pipe to a process, typically a data-filter such 111as compression or decompression programs. 112The 113.Pa rfilter 114namespace opens a read-only pipe, while the 115.Pa wfilter 116namespace opens a write-only pipe. 117See the 118.Sx EXAMPLES 119section below for more examples. 120.Sh CONFIGURATION FILE 121The configuration file contains a list of rules. 122Each rule takes one line and consists of two or more 123whitespace separated fields. 124A hash 125.Pq Dq # 126character causes the remainder of a line to be ignored. 127Blank lines are ignored. 128.Pp 129The first field is a pathname prefix to match 130against the requested pathname. 131If a match is found, the second field 132tells the daemon what type of object to create. 133Subsequent fields are passed to the creation function. 134.Pp 135The 136.Pa rfilter 137and 138.Pa wfilter 139namespaces have additional meanings for the remaining fields. 140The third field specifies a prefix that is to be stripped off of 141the passed name before passing it on to the pipe program. 142If the prefix does not match, no stripping is performed. 143The fourth argument specifies the program to use for the pipe. 144Any remaining fields are passed to the pipe program. 145If the string 146.Dq Li "%s" 147exists within these remaining fields, it will be replaced by the 148path after stripping is performed. 149If there is no field after the program name, 150.Dq Li "%s" 151will be assumed, to maintain similarity with the 152.Pa tcp 153and 154.Pa fs 155namespaces. 156.Sh FILES 157.Bl -tag -width /p/* -compact 158.It Pa /p/* 159.El 160.Sh EXAMPLES 161A tutorial and several examples are provided in 162.Pa /usr/share/examples/mount_portal . 163The following is an example configuration file. 164.Pp 165.Bd -literal 166# @(#)portal.conf 5.1 (Berkeley) 7/13/92 167tcp/ tcp tcp/ 168fs/ file fs/ 169echo/ rfilter echo/ echo %s 170echo_nostrip/ rfilter nostrip echo %s 171echo_noslash rfilter echo_noslash echo %s 172gzcat/ rfilter gzcat/ gzcat %s 173gzip/ wfilter gzip/ gzip \*[Gt] %s 174gzip9/ wfilter gzip9/ gzip -9 \*[Gt] %s 175ftp/ rfilter ftp/ ftp -Vo - %s 176ftp:// rfilter nostrip ftp -Vo - %s 177http:// rfilter nostrip ftp -Vo - %s 178bzcat/ rfilter bzcat/ bzcat %s 179nroff/ rfilter nroff/ nroff -man %s 180.Ed 181.Pp 182As is true with many other filesystems, a weird sense of humor is handy. 183.Pp 184Notice that after the keynames, like nroff/ and bzcat/, we 185typically use another slash. 186In reality, the 187.Nm 188process changes directory to 189.Pa / , 190which makes the subsequent slash unnecessary. 191However, the extra slash provides a visual hint 192that we are not operating on an ordinary file. 193An alternative would be to change the configuration 194file to something like: 195.Bd -literal 196nroff% rfilter nroff% nroff -man 197.Ed 198.Pp 199One might then use 200.Bd -literal 201less /p/nroff%/usr/share/man/man8/mount_portal.8 202.Ed 203.Sh SEE ALSO 204.Xr mount 2 , 205.Xr unmount 2 , 206.Xr fstab 5 , 207.Xr mount 8 208.Sh HISTORY 209The 210.Nm 211utility first appeared in 212.Bx 4.4 . 213The 214.Pa rfilter 215and 216.Pa wfilter 217capabilities first appeared in 218.Nx 1.5 . 219.Sh BUGS 220This filesystem may not be NFS-exported. 221