From 8bfe39e93cbddef240951b00cbbf9a6663c6af95 Mon Sep 17 00:00:00 2001 From: bapt Date: Mon, 20 Jan 2014 15:33:31 +0000 Subject: [PATCH] MFH: r260483, r260484, r260594, r260595, r260596, r260597 Improve error message shown to the user when trying to load a module that is already loaded or compiled withing the kernel Point the user to dmesg(1) to get informations about why loading a module did fail instead of printing the cryptic "Exec format error" Update the BUGS section of kld(4) according the recent changes in kldload(8) git-svn-id: svn://svn.freebsd.org/base/stable/9@260909 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sbin/kldload/kldload.c | 17 ++++++++++++++++- share/man/man4/kld.4 | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sbin/kldload/kldload.c b/sbin/kldload/kldload.c index 84589eb49..3891f3328 100644 --- a/sbin/kldload/kldload.c +++ b/sbin/kldload/kldload.c @@ -181,7 +181,22 @@ main(int argc, char** argv) printf("%s is already " "loaded\n", argv[0]); } else { - warn("can't load %s", argv[0]); + switch (errno) { + case EEXIST: + warnx("can't load %s: module " + "already loaded or " + "in kernel", argv[0]); + break; + case ENOEXEC: + warnx("an error occurred while " + "loading the module. " + "Please check dmesg(8) for " + "more details."); + break; + default: + warn("can't load %s", argv[0]); + break; + } errors++; } } else { diff --git a/share/man/man4/kld.4 b/share/man/man4/kld.4 index c36f6ab24..de991c40f 100644 --- a/share/man/man4/kld.4 +++ b/share/man/man4/kld.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 1998 +.Dd January 13, 2014 .Dt KLD 4 .Os .Sh NAME @@ -166,8 +166,8 @@ binary, then fails to execute the entry point. .Pp .Xr kldload 8 -returns the cryptic message -.Sq Li "ENOEXEC (Exec format error)" +points the user to read +.Xr dmesg 8 for any error encountered while loading a module. .Pp When system internal interfaces change, old modules often cannot -- 2.45.0