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

Albert D. Cahalan (acahalan@cs.uml.edu)
Wed, 17 Dec 1997 14:31:14 -0500 (EST)


Mike Jagdis writes:
>On Tue, 16 Dec 1997, Felix Schroeter wrote:
>
>>>> 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 :-).
>>
>>> 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.

BSD does not support many things. I don't think Linux is
meant to have a strict subset of BSD features.

Perhaps we should get rid of clone(), since BSD does not support it.

> I remember now. iBCS does it because when you have STREAMS based
> transports names really do map directly to transport end points
> and a t_open() call really does do an open() with the expectation
> of ending up with an actual connection. In theory you could write
> programs for STREAMS based systems that do their on open() but
> that would be relying on undocumented and potentially incorrect
> behaviour. It doesn't seem reasonable to support such code :-).

It is 100% reasonable, since it is a useful feature. If other
systems don't add the feature, that is _thier_ problem.
Portability concerns belong in the man pages, not in the kernel.
I'm happy that Linux mmap() supports a non-standard extension to
MAP_ANON. I'm not at all happy that the man page recommended it!

(not in libc either; that _GNU_SOURCE junk is broken)