Subject: Re: QMAGIC vs ZMAGIC
To: Andrew Cagney <>
From: Theo de Raadt <>
List: tech-kern
Date: 06/19/1994 17:36:01
> I ask as for NetBSD, the header is in the first page of text (sounding
> like a QMAGIC file) yet the magic number for the executable is set to

Standard BSD doesn't map out the first page for ZMAGIC. Many other
groups (Sun, for the best example) changed the load address so that
ZMAGIC, OMAGIC, NMAGIC unmaps the first page. This is a wise move, as
it catches all kinds of bugs.

Now, if you're going to change the load address, why do you need to
make a new magic number? Why not just change all of ZMAGIC, OMAGIC,
NMAGIC, so that they all just map at a new location? Why do you need
to make a new magic number?

Ie. Why is there no corresponding QMAGIC-style thing for NMAGIC or

So that's why I did the obvious thing, and at the same time made the
magic number network-order, so that this works (and so that sh has a
better chance of telling that a random executable file isn't a shells

% uname -sm ; file /usr/src/obj-i386/bin/cat/cat
NetBSD sparc
/usr/src/obj-i386/bin/cat/cat: NetBSD/i386 demand paged executable not stripped