Re: Open() UNIX socket = socket() + connect() ?

Felix Schroeter (felix@mamba.pond.sub.org)
Tue, 16 Dec 1997 21:59:26 +0100 (CET)


Hello!

In article <Pine.LNX.3.91.971215172500.14931H-100000@toaster.roan.co.uk> you write:
>[...]

>> What would be against it to handle an open() of a UNIX domain socket like
>> a socket() / connect() pair ? Any pros/cons? Do other UNIXes do this?

>iBCS does :-). It's pretty trivial to add to the kernel itself. If
>do_open() (or whatever) sees the sock flag set in the inode modes
>(or whatever) it just needs to do a socket(...AF_UNIX...), connect(...)
>using the given pathname. All else falls into place (<thud>).

> Whether it is a good idea or not is another question. iBCS does
>it to make things work for foreign programs but off hand I can't
>remember if this is because other systems really do let you open
>Unix domain sockets.

BSD does not support open() on UNIX domain sockets, either. I've
talked to a friend about that. He thinks that while there's no good
reason against that support, if open() on sockets were implemented
e.g. on Linux, of course rather some people would actually use it,
unnecessarily making their programs less portable. So in the real
world, with diverse UNIX like operating systems, that feature would
probably do more damage than use.

And it isn't too difficult to do socket() and connect() yourself,
anyway.

Regards, Felix.