Subject: "real" OpenBSD compat - how hard would it be?
To: None <port-i386@netbsd.org>
From: Urban Boquist <boquist@crt.se>
List: port-i386
Date: 03/19/2003 16:36:06
So, it seems that the days when you could just take any OpenBSD (i386)
binary and run it on NetBSD (i386) and it would Just Work are
definitely over.

Does anyone have any idea on how much work a real kernel level
compat/openbsd would be?

Here's an example, a system call problem I ran into today:

$ file ./ghc-5.04.3
./ghc-5.04.3: NetBSD/i386 demand paged dynamically linked executable

[but the binary is in fact built on OpenBSD/i386 3.3beta]

$ ./ghc-5.04.3
Bad system call

A ktrace reveals this:

18327 ghc-5.04.3 CALL  #253 (unimplemented)
18327 ghc-5.04.3 RET   #253 (unimplemented) -1 errno 78 Function not implemented

#253 according to the OpenBSD numbering seems to be issetugid(2),
which in NetBSD is at #305. According to the NetBSD manpage it was
taken from OpenBSD via FreeBSD, but FreeBSD seems to use #253, so I
have no idea why we chose another number (#253 is free in NetBSD as
far as I can see)... Maybe it was intentional?

Kind regards,

        -- Urban

P.S. I understand that we may currently have problems identifying
OpenBSD binaries during exec, to trigger the right emulation, but that
is really a different problem. And there have been various suggestions
on how that could be handled.