Which *nix ? BSD : System V
Guy Harris
guy at rlgvax.UUCP
Sun Feb 17 06:22:44 AEST 1985
> If you need to know at compile time whether you're on a Berklix or
> a System V system, this might help. It seems to work on all of our
> systems, including the Pyramid split universe wonder:
>
> # include <fcntl.h>
> # ifdef FNDELAY
> # define BSD
> # else
> # define SYS5
> # endif
>
> This assumes that FNDELAY is not defined in the System V fcntl.h, and
> is in the BSD. Can anyone think of a case where this is not true,
Yes - 4.1BSD. It would produce an error complaining that <fcntl.h>
couldn't be found. If you assume that the only UNIXes you're interested
in are 4.2BSD and System III/System V, this will work (no V7, no 4.1BSD).
It also won't work on the OS we're doing for the Power 6/32, if you're really
interested in a strict 4.2/S5 distinction. It would think you were on
a 4.2 system - we don't have two universes. However, most 4.2 stuff should
work; our TTY driver, though S5 based, has all the Berkeley features in it
(job control, correct "echoe" handling, "prterase", "crtkill", "ctlecho",
etc., etc.) and has replaced the UNIX/TS 1.0 backward compatible "ioctl"s
with V7/4.2BSD backward compatible "ioctl"s (I've successfully run the
off-the-tape 4.2BSD binaries of "csh" and "vi").
I'm not sure what the result would be with Doug Gwyn's SysV emulation
under 4.2BSD, either; if it doesn't provide a separate copy of <fcntl.h>
your program would be built for 4.2BSD, but would be linked with SysV
libraries.
Guy Harris
{seismo,ihnp4,allegra}!rlgvax!guy
More information about the Comp.unix.wizards
mailing list