[OpenAFS-devel] Refactoring the Solaris libafs code base

Russ Allbery rra@stanford.edu
Wed, 27 Dec 2006 20:07:26 -0800


Marcus Watts <mdw@umich.edu> writes:

> fcntl.h has been in bsd since 4.2, in AT&T since system III, in SunOS
> since it was called Sun UNIX, and in linux since presumably its start.
> Since it's clearly in windows a well, it should be safe to include it
> everywhere needed with no configure test or #ifdef logic.

> string.h has been in bsd since 4.4bsd, and in AT&T since system 5.  It
> wasn't in 4.2bsd, sunos, etc, but as people have pointed out this
> probably doesn't matter.  I doubt there are any supported platforms for
> AFS where there needs to configured ifdef logic when including it.

At least in user-space code (I don't know if kernel-space is special), at
least all of the following C headers can be included without any guards on
any Unix platform we care about:

errno.h
fcntl.h
stdarg.h
stdio.h
stdlib.h
string.h
sys/stat.h
sys/types.h
syslog.h
unistd.h

I'm fairly sure that while there are special Autoconf probes for the
following, we no longer need to worry about these either:

sys/time.h
sys/wait.h
time.h

All of the networking headers can be included without guards:

arpa/inet.h
netdb.h
netinet/in.h
sys/socket.h

except that netinet/in.h has to be included before arpa/inet.h on BSDi,
should we ever care about that platform.  In order to get the prototype
for select() on AIX, you do need to include sys/select.h, which doesn't
exist on some other platforms, so that requires an Autoconf probe.

*Most* Autoconf header probes are unnecessary and are copied around by
cargo-cult practice from software that used to be portable to SunOS,
Ultrix, NeXTSTEP, and similar obsolete platforms.

I don't know what specific additional requirements Windows adds for code
that should also build on Windows.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>