Subject: Re: unix domain sockets with open() ability?
To: Matthew Jacob <>
From: Todd Vierling <>
List: current-users
Date: 09/23/1997 16:53:39
On Tue, 23 Sep 1997, Matthew Jacob wrote:

: Yeah, right... It's a named two-way pipe, essentially. Yeah, this is
: what the streams pipe device gets one. I just got through doing some
: work for someone fooling around with this.
: How this would bind to AF_UNIX domain sockets, I dunno...

I don't think that the streams pipe interface could attach to this, because
sys_open() deliberately goes off and calls vn_open() to open a vnode file.
vn_open() has a statement that deliberately exits with a vnode of type

After probing the code in src/sys/kern, I was contemplating a few different
possible methods of making unix domain sockets openable: 

- lkm overlay that does an extra namei lookup and does a deliberate socket
descriptor setup and connect() on a vnode that is of type VSOCK (but this
would double the number of namei lookups on open() calls, not really good); 

- adding the ability for vn_open() to create a connected socket "hidden" in
the returned vnode, to be picked up by sys_open() (but this is really a
hack, as there's no defined method for returning a connected socket instead
of a vnode to sys_open()); 

- making vn_open() actually return the destination socket vnode (not a
connected socket) with a "fake" set of fileops returning ENOTSUPP or
similar, to be detected by sys_open() and transformed into a connected
socket (this is appealing, but would it break other things that call

- vn_open() actually connecting a socket and making a socket based set of
vnops (but then you couldn't use *sockopt(), send(), recv() on it);

- rewriting sys_open() into two segments that does a vfs lookup to a locked
vnode beforehand in the nameidata struct, then calls vn_open(), which has
been modified to check for the presence of an already locked vnode in the
nameidata struct... but skips calling vn_open() and opens a socket instead
for a vnode of type VSOCK (this seems the best option, as it allows
"correct" operation of vn_open() while allowing the vnode to be locked

List:  opinions?

== Todd Vierling (Personal; Business
== I know you like the Internet, Bobby.  Now go eat your Frosted Flakes.