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

Mike Jagdis (mike@roan.co.uk)
Mon, 15 Dec 1997 17:30:42 +0000 (GMT/BST)


On 15 Dec 1997, Miquel van Smoorenburg wrote:

> I currently have an application that uses a named pipe to listen for
> commands. I'd like to extend the app to 2way communication, so that
> would mean a UNIX domain socket. However I want to keep the interface
> the same.
>
> 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.

Mike

-- 
.----------------------------------------------------------------------.
|  Mike Jagdis                  |  Internet:  mailto:mike@roan.co.uk   |
|  Roan Technology Ltd.         |                                      |
|  54A Peach Street, Wokingham  |  Telephone:  +44 118 989 0403        |
|  RG40 1XG, ENGLAND            |  Fax:        +44 118 989 1195        |
`----------------------------------------------------------------------'