Universal OS (was Re: Survey of architectures)
Guy Harris
guy at gorodish.Sun.COM
Tue Apr 26 10:26:46 AEST 1988
> 3. OS - what is the interface to the signal handler under
> SYS V and BSD!
This particular point really continues a discussion started in comp.lang.c.
The discussion was inspired by some misconceptions about UNIX signal handlers.
Any rational version of UNIX will permit signal handlers to take a single
argument that is the signal number. Any version that obliges signal handlers
to be written to take more than one argument will cause *so* much
already-written code to break that it can fairly well considered to be broken
itself.
Fortunately, 4BSD has, as far as I know, only been implemented only on systems
where the extra "signal code" argument that it passes doesn't make a
difference. As such, it is not (yet) broken in that sense.
ANSI C specifies that signal handlers take one and only one argument. This
also happens to break existing code; however, assuming that there are machines
that cannot support "varargs" without "varargs" functions being explicitly
declared as such, they had no choice.
In other words, if you want to write portable code, write it so that signal
handlers take one argument. This will work on any non-broken UNIX system.
Thus, the issue of the interface to the signal handler is not an issue raised
by multiple versions of UNIX. It *is* an issue if you have non-UNIX systems,
but if you have to deal with non-UNIX systems, it's probably one of the least
of the issues you will have to deal with.
As for the relevance of this point to "most people" and "most users", the
people mentioned in the original article: to borrow a phrase I have heard
attributed to Frank Zappa, "most people" or "most users" wouldn't know a signal
handler if it came up and bit them in the ass.
More information about the Comp.unix.wizards
mailing list