kldload exec format error on amd64 freebsd-7.1-rc2

Robert Watson rwatson at FreeBSD.org
Tue Jan 20 13:19:04 PST 2009


On Tue, 20 Jan 2009, Dag-Erling Smørgrav wrote:

> Barney Cordoba <barney_cordoba at yahoo.com> writes:
>> Is there any interest in fixing this stupid and wrong error message to be 
>> something like "unresolved externals" at some point?
>
> When the kernel fails to load a module, kldload(2) returns ENOEXEC, which 
> strerror(3) translates to "exec format error".  If you can think of a better 
> errno value to use, feel free to send patches.  The only alternatives I can 
> think of are ENOSYS (ambiguous) and EFTYPE (just as vague as ENOEXEC).

A number of other UNIXy OS's have extended the errno space to support user 
linker errors in a bit more detail, it could be that we could reuse/abuse a 
few of them:

ELIBACC		Solaris/Linux		Can't access needed shared lib
ELIBBAD		Solaris/Linux		Accessing a corrupted shared lib
ELIBSCN		Solaris/Linux		.lib section in a.out corrupted
ELIBMAX		Solaris/Linux		Attempting to link in too many libs
ELIBEXEC	Solaris/Linux		Attempting to exec a shared library
EBADEXEC	Mac OS X		Bad excutable
EBADARCH	Mac OS X		Bad CPU type in executable
ESHLIBVERS	Mac OS X		Shared library version mismatch

Or, we could add a couple of new errno values.  This has come up a number of 
times and people do find it confusing that the errors returned aren't very 
related to the error.  Another alternative would be to add a new kldload() 
system call that explicitly returns a more detailed error number space 
independent of the errno space.

Robert


More information about the freebsd-current mailing list