Subject: Again, open() on unix domain sockets... one alternative
To: None <current-users@NetBSD.ORG>
From: Todd Vierling <tv@pobox.com>
List: current-users
Date: 09/24/1997 20:33:10
Available at ftp://ftp.duh.org/pub/NetBSD-hacks/mount_portal/ is a patch
against -current src/sbin/mount_portal/ sources and one new file, pt_sock.c.

These allow functionality similar to pt_file.c (in fact, much of the code
_is_ pt_file.c) where the method used to open the file is not open(), but
socket() followed by connect().  I chose to make a different protalfs module
rather than modify pt_file.c to leave the leeway that the kernel might
support open()ing sockets with a different set of semantics someday.  :) 

The provider name is 'sock', so the portal.conf line:
        sock/ sock sock/
is sufficient to make a /p/sock pathname to open unix domain sockets with. 
Note that because of the 104 character pathname limit on unix domain sockets
(is this really a hard limit, still?) it can be difficult to use this
interface to access a socket buried in the filesystem.

I'm still going to try to figure out a way to get it into the kernel ('cause
I still believe it _should_ work), but it'll be a little while.  I've
realized some other problems (permissions that aren't set read _and_ write
should force a one-way stream), and am thinking them out.

I ask that the extra file and modifications be incorporated into the tree if
core feels this is a good addition.  I have preserved the pt_file.c
copyright in pt_sock.c (since that it the base code), with another copyright
line.  The patch also comments out 'exec', 'pipe', and 'tcplisten' in the
example portal.conf with a comment that they are unimplemented. 

=====
== Todd Vierling (Personal tv@pobox.com; Business tv@lucent.com)
== I know you like the Internet, Bobby.  Now go eat your Frosted Flakes.