[comp.unix.wizards] Sun, sockets, and 4.3

mouse@mcgill-vision.UUCP (der Mouse) (11/21/88)

I just finished writing an elaborate network server, which I expect to
need to restart periodically.  So I added code to it so that when
another copy is started, it attempts to "hand off" all current
connections via the AF_UNIX socket access rights mechanism.  I just got
it all to the point where it ought to work and now I find out that Sun
3.5 doesn't support passing access rights over UNIX domain sockets.
(Apparently they just couldn't be bothered, because they picked up the
IP networking code from 4.3, and the access rights mechanism really
isn't that complicated.  mutter mutter.)

So, before I start trying to twist the 4.3 code to fit into a 3.5
kernel,

1) Does anybody have any other way of passing file descriptors between
   processes?  (Must be *passing* descriptors; common ancestors passing
   descriptors down through fork() doesn't help.)

2) Does anybody have the access rights mechanism working on any Sun not
   running release 4.x?  (It does work on 4.x, but that doesn't help
   this situation any, I'm afraid.)

3) Does anybody happen to know how come Sun neglected to pick this up
   with the rest of the 4.3 networking code?

Any help at all would be much appreciated.  Mail or post, whatever you
like; as long as I see it, it doesn't matter how it gets to me.

A couple more little friendlies like this and I'll be about ready to
try porting 4.3 to the Sun.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

mouse@mcgill-vision.UUCP (der Mouse) (11/24/88)

In article <1358@mcgill-vision.UUCP>, mouse@mcgill-vision.UUCP (der Mouse) writes:
> [I had a use for AF_UNIX access rights passing]  I just got it all to
> the point where it ought to work and now I find out that Sun 3.5
> doesn't support passing access rights over UNIX domain sockets.

> [asking for help, with various swipes at Sun]

After exchanging letters with a couple of people at Sun and hacking on
my code a bit, I can now report:

- Sun 3.5 does not support passing access rights in the way 4.3 does.

- It does support it in some form, which I am told is the way 4.2 does.
  I can't check this personally, not having a 4.2 machine around.

- The support that is there works, with a couple of minor glitches.

In addition, I believe I was harsher on Sun than the situation called
for, for which I would like to apologize.

The glitches:

- Using sizeof(struct sockaddr_un) as an address size (eg, the third
  argument to bind() does not work.  This is because sizeof(sun_path)
  is odd, so the structure gets padded....

- Using sizeof(struct sockaddr_un)-1 in the mh_namelen field for a
  sendto() produced panic: sbappendaddr.  I had to use
  strlen(foo.sun_path)+3, which is ugly because that 3 is unobvious.

I have been told that the first of these was present in 4.2; presumably
the other is too.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu