Here's the flame everyone's asking for (was Re: Shared Memory in BSD4.3 is lacking?)

Mike Ditto ford at kenobi.UUCP
Thu Mar 3 19:59:18 AEST 1988


Posting-Front-End: GNU Emacs 18.41.10 of Fri Oct  2 1987 on kenobi (usg-unix-v)


In article <997 at PT.CS.CMU.EDU> jgm at K.GP.CS.CMU.EDU (John Myers) writes:

> In article <43 at kenobi.UUCP> ford at kenobi.UUCP (Mike Ditto) writes:
> >In article <2009 at ho95e.ATT.COM> wcs at ho95e.ATT.COM (Bill.Stewart) writes:
> [ Justified Missed'em V flaming ]
> >On Berkeley Unix, the primary IPC mechanism (the socket) is very
> >nicely implemented in a way consistent with the previously existing
> >I/O facilities.  In particular, it is accessed in the same way as
> >files and other I/O: with a "file" descriptor.
>
> Then why the heck can't you open(2) a BSD unix domain socket?  The
> semantics seem pretty obvious. (Create a new socket and connect to
> the socket named in the open call.)  Sounds like <10 lines of code to
> me.

The main reason that I see is that a Unix domain socket is not really
supposed to show up in the filesystem, and it supposedly doesn't in
more recent BSD releases (4.3?).  I don't think it has ever been clear
whether the "Unix domain" of socket names(addresses) is really
supposed to map into pathnames in the ("open"able) filesystem.  Is it
possible to bind an AF_UNIX socket to "/foo/bar/baz" if there is no
directory "/foo"?  I assume this won't work on 4.2, since it can't
create the "named socket".  But on 4.3 I don't know why it wouldn't
work.  In other words, the "name" that an AF_UNIX socket is bound to
does not need to have any relation to the file system.  You could
probably bind a socket to "/////////".  (I don't know, I haven't been
on a BSD system in quite a while).

> Something that would be harder, but would still be incredibly useful
> would be to automaticly unlink a socket when the (last) process owning
> that socket exits.

That would be inconsistent with files, which are not unlinked under those
circumstances.  Either the socket should "really" have a name in the
file system (and be openable, etc.) or it's address should have nothing
to do with the existence or non-existence of a file by the same name.
Both kinds of sockets could be useful.

					-=] Ford [=-

"Well, he didn't know what to do, so	(In Real Life:  Mike Ditto)
he decided to look at the government,	ford%kenobi at crash.CTS.COM
to see what they did, and scale it	...!sdcsvax!crash!kenobi!ford
down and run his life that way." -- Laurie Anderson



More information about the Comp.unix.wizards mailing list