Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Feb 1997 08:16:03 -0700
From:      Warner Losh <imp@village.org>
To:        obrien@NUXI.com (David O'Brien)
Cc:        freebsd-ports@freebsd.org (FreeBSD ports list), hackers@freebsd.org
Subject:   Re: conditionally including <sys/param.h> 
Message-ID:  <E0vs94u-0000u5-00@rover.village.org>
In-Reply-To: Your message of "Wed, 05 Feb 1997 00:33:43 PST." <19970205003343.YB13323@dragon.nuxi.com> 
References:  <19970205003343.YB13323@dragon.nuxi.com>  <19970202135048.PN07710@dragon.nuxi.com> <199701280143.RAA06503@freefall.freebsd.org> <Pine.OSF.3.95q.970127210526.2115E-100000@uplink.eng.umd.edu> <E0vrw2G-0000I7-00@rover.village.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <19970205003343.YB13323@dragon.nuxi.com> David O'Brien writes:
: Then what would you suggest?  Are they really more different than all the
: various sysVr4 that define __svr4__?  How close is Solaris, UnixWare, and
: Irix?

Ummm, they don't all define svr4 in all versions.  Solaris didn't
define it until at least the 3.0 release of the C compilers.  I'm not
sure if the current gnu tools define this for all of these systems.
And they all have sys/param.h :-

: I'm just trying to find something that will cover all the 4.4BSD derived
: OS's.  What are the big divergances from each other that __44bsd__
: wouldn't cover (from an application standpoint)?  Remember I'm trying to
: catch things like sys_errlist[], termios, /var/mail, /usr/sbin/sendmail,
: etc

Better to include sys/param.h, from a portability standpoint, and
check to see if BSD is defined and larger than a certain value.  The
hard part is knowing if sys/param.h will be there.

: Everyone will acknowlege that for kernel stuff __FreeBSD__, etc.
: should be used.  But I still think __44bsd__ is fine where we would
: already do the #if (BSD > xyx) test or defined(__FreeBSD__) ||
: defined(__NetBSD__) ,etc.

Yes, but there are enough "dusty deck" systems out there that software
authors will still need to do other checks.  It would be better to
find a foolproof way of knowing when sys/param.h is available (or at
least when it generally isn't).

Most of the examples that you sighted can be handled better by other
means.  Don't declare sys_errlist at all, rather use strerror() or
#include <errno.h> (which is fairly standard).  Don't use hard wired
path names, but rather the standard ones defined in pathnames.h.
You'll likely have to have a fallback for that strategy as well.

Also, as time moves forward, some new systems will adopt parts of the
4.4 tree.  Do you really want to have things like:

#if defined(__bsd44__) || (defined(SOLARIS) && SOLARIS >= 207) ...

in the sources?  They quickly get out of hand.

Many of the ports have 2-3 lines of ifdefs to include stdlib.h, when
instead they should have a single #ifdef __STDC__ in its place.

Had BSD 4.4 come out with this symbol, things would be a little
different.  However, it didn't think that it would be worth the
portibility hassles at this point, since it would take time for this
symbol to propigate to all flavors of BSD.  2.2 is almost out the
door, OpenBSD 2.0 is on the streets (and will be for a while).  Netbsd
1.2 is also on the streets and likely will be for a while too.

I guess I'm just showing my years of riding heard on the OI/uib source
tree which was generally portable to the point that the compile time
(45 minutes to an hour) usually dominated the porting time (well, and
sometimes it was the licenese manager third party code too).

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E0vs94u-0000u5-00>