[RFC] More meaningful information about ENOEXEC for kldload(8)

Xin LI delphij at delphij.net
Mon Oct 25 19:19:40 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

Here is a simple patch that adds more meaning messages when kldload hits
ENOEXEC.

Before patch:

kldload: can't load geom_eli.ko: Exec format error

After patch:

kldload: can't load geom_eli.ko: Exec format error
kldload: Dependendent kernel module cannot be loaded from kern.module_path?

Comments?

Cheers,
- -- 
Xin LI <delphij at delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!	       Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iQEcBAEBCAAGBQJMxdg+AAoJEATO+BI/yjfBEasH/1vKrCT/HX0xEUFYLEK5mjNr
iZPJVIpe5R9jRWLzb1065qMQR5eMgiotig9p/ymOebq3azQAsDagOJDzzYa46ReS
yNlUYq6GnVHsOh15cBHxtRBkuJ0Q3jWammPAXf0oYmvFrPBQstLp7iyhS7PZUUBb
7DnFMPLh3FSiovli6JFwhHpYQSDwz7K4UPzj/Un0DwuMoz8fyGoyOz8ZRqAY6D5g
GwesbqBhjDaOuwJNFaNcjoEK4Eq/iwkotZCz7l38Skmlle7wwycuyYdEIuk9feiS
/dn4CyhzKwNVbVPqZOEJ99bAuxJUwsfDEpGeYLH97rGqz7U4Y6LM18R/fip+0DM=
=qeYL
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: kldload.c
===================================================================
--- kldload.c	(revision 214146)
+++ kldload.c	(working copy)
@@ -33,6 +33,7 @@
 #include <sys/sysctl.h>
 #include <sys/stat.h>
 #include <err.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -171,6 +172,9 @@
 			fileid = kldload(argv[0]);
 			if (fileid < 0) {
 				warn("can't load %s", argv[0]);
+				if (errno == ENOEXEC && !quiet)
+					warnx("Dependendent kernel module can't"
+					    "be loaded from kern.module_path?");
 				errors++;
 			} else {
 				if (verbose)


More information about the freebsd-current mailing list