Subject: Re: Problems with gdb under NetBSD 1.0
To: Tobias Weingartner <>
From: Mark P. Gooderum <>
List: current-users
Date: 12/14/1994 11:33:03
> In message <>, "Mark P. Gooderum" writes:
> > 
> [Deleted.]
> > 
> Yuk!  I don't care what people say, but *THAT* is hideous!  Nothing against
> the original poster...

No offense taken.  This example was a bit contrived, but there are
some "standard" things that are uglier.

Portability is not pretty.  Esp. if you try to run accross things varying 
from Ancient to modern, and that's just Unix.  Try to handle restartable
system calls portably accross SunOS 4 (with and without the bundled
compiler), Solaris 2, Ultrix 4, DG/UX, HP/UX 8 and 9, etc...

Now the "ugly" code isn't scattered all over your code.  Often the
best approach is to write a wrapper function that supports the subset
of functionality that you care about, and isolate all the portability
code in there.  Ala: "my_sigaction()", which knows whether to use
sigvec() or sigaction(), whether to use the POSIX flag SA_RESTART or 
not use the SV_INTERRUPT flag, and whether it needs to do something 
really ugly, such as what needs to be on on HP/UX for restartable system
calls or on AIX for a real seteuid().

If you limit your problem, such as saying that you'll only support
98%+ POSIX.1ish systems with an ANSI compiler, many things get
much simpiler, but there are some Unixes out there that are still
significant in some areas that don't meet thse requirements (SunOS 4,
BSD 4.3, and Ultrix come to mind).

The winnage with autoconf is that tests are specific to a feature or
behavior and that the tests are done automatically for a given
system, so new ports are much easier.  You also avoid the classic
problem of reading too much into a high level define as things
evolve.  For instance, how much old code assumes that #ifdef BSD 
means that memcpy() isn't available or that sgtty should be used
instead of termios, or that #ifdef SYSV means no sockets or that
signals are unreliable.