svn commit: r321658 - head/usr.sbin/binmiscctl

Sean Bruno sbruno at FreeBSD.org
Fri Jul 28 18:11:55 UTC 2017


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 at 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));


More information about the svn-src-head mailing list