OpenSolaris

You are not signed in. Sign in or register.

HEADS UP -- AF_LOCAL and friends now defined in <sys/socket.h>

Date: Thu, 30 Oct 2008 00:18:40 -0400
From: Dan McDonald <danmcd at sun dot com>
To: onnv-gate at onnv dot eng dot sun dot com, on-all at sun dot com
Subject: HEADS UP -- AF_LOCAL and friends now defined in <sys/socket.h>

Hello gatelings!

The seemingly simple change of adding AF_LOCAL (as well as PF_LOCAL, AF_FILE,
and PF_FILE) to be an alias of AF_UNIX may cause interesting consequences for
people who compile open-source packages.

There are more than a few open-source packages that refuse to say "AF_UNIX"
anywhere in their code (probably for religious reasons) and therefore have
blocks of unused code like this:

	#ifdef AF_LOCAL
		struct sockaddr_un sun;  /* KEBE SAYS watch out! */

		sun.sun_family = AF_LOCAL;
		....

	#endif

Notice where KEBE spoke up.  Sometimes when we compile code with the right
flags, "sun" is defined to be '1', because there are blocks of code out there
with:

	#ifdef sun
		/* Do Solaris/Sun-specific things... */

	#endif

So if you see variables in now-compiling blocks named "sun", you may wish to
change them to something else.  I delayed putting this back so OpenSolaris
2008.11 wouldn't have any surprises for open-source developers or builders.

So be aware that with this putback, some of your dormant open-source code
will start compiling, and sometimes with unintended consequences.

Thanks!
Dan McD.

p.s. If someone could forward this to X, SFW, and JDS folks, I'd really
     appreciate it.