Compile error with /usr/include/linux/un.h

Christopher A. Smith (casmith@clark.net)
Fri, 14 Jun 1996 07:57:43 -0400 (EDT)


Yesterday afternoon I was porting the latest version of my project's
distributed information systems software to the latest version of Linux.
The compile of roughly 1,000 files -- 311,000 lines of code -- took about
12 minutes on my Pentium 166 and required less than two minutes of code
modification -- tweak an #include statement here and there. Nice work,
guys!

I did stumble across a compilation error in /usr/include/linux/un.h that
appeared only because of the compilation flags we're using: the dreaded
"-ansi -pedantic". It's a project requirement which resulted from
problems with portability between compilers (commercial compilers were
rejecting things gcc ignored, even with -Wall and friends turned on) and
architectures, and it's something I can't do much about. gcc complained
about the zero-length array which is declared in the cmsghdr struct in
un.h. I understand why it's being done that way; I've seen other OS's do
the same thing.

I'd built this stuff under Linux 1.2.13 and some 1.3.x kernels, and in
their versions of un.h, the cmsghdr struct wasn't there. The only type
definition in the file was sockaddr_un.

I see myself as having only a couple of choices, and I'd appreciate any
feedback, if anyone's in the mood:

1. Don't compile with -ansi -pedantic: It'd certainly work, but I wouldn't
be able to submit these modifications for integration into our final
product.

2. Change the array to have one element.

3. Find a new home, either in a new file or through an #ifdef, for the
cmsghdr struct.

Any thoughts??? Thanks!

--------------------------------------
Christopher A. Smith
Arlington VA * casmith@clark.net