Date: Fri, 28 Jul 2017 18:11:53 +0000 (UTC) From: Sean Bruno <sbruno@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321658 - head/usr.sbin/binmiscctl Message-ID: <201707281811.v6SIBrH6000428@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sbruno Date: Fri Jul 28 18:11:53 2017 New Revision: 321658 URL: https://svnweb.freebsd.org/changeset/base/321658 Log: binmiscctl should use modfind instead of kldfind kldfind() only matches kernel modules, so if you link imgact_binmisc directly into the kernel, binmiscctl can't find it, tries to load it, and errors out with: Can't load imgact_binmisc kernel module: File exists A quick search of other base commands shows that the correct procedure is to call modfind(), and then try kldload() if that fails. PR: 218593 Submitted by: Dan Nelson <dnelson_1901@yahoo.com> MFC after: 1 week Modified: head/usr.sbin/binmiscctl/binmiscctl.c Modified: head/usr.sbin/binmiscctl/binmiscctl.c ============================================================================== --- head/usr.sbin/binmiscctl/binmiscctl.c Fri Jul 28 18:09:41 2017 (r321657) +++ head/usr.sbin/binmiscctl/binmiscctl.c Fri Jul 28 18:11:53 2017 (r321658) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/imgact_binmisc.h> #include <sys/linker.h> +#include <sys/module.h> #include <sys/sysctl.h> enum cmd { @@ -401,7 +402,7 @@ main(int argc, char **argv) size_t xbe_out_sz = 0, *xbe_out_szp = NULL; uint32_t i; - if (kldfind(KMOD_NAME) == -1) { + if (modfind(KMOD_NAME) == -1) { if (kldload(KMOD_NAME) == -1) fatal("Can't load %s kernel module: %s", KMOD_NAME, strerror(errno));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707281811.v6SIBrH6000428>