Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Oct 2013 16:18:48 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257213 - head/cddl/contrib/opensolaris/cmd/lockstat
Message-ID:  <201310271618.r9RGImt7034934@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Sun Oct 27 16:18:48 2013
New Revision: 257213
URL: http://svnweb.freebsd.org/changeset/base/257213

Log:
  If the initial attempt to open /dev/ksyms fails, kldload the ksyms module
  and retry.

Modified:
  head/cddl/contrib/opensolaris/cmd/lockstat/sym.c

Modified: head/cddl/contrib/opensolaris/cmd/lockstat/sym.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/lockstat/sym.c	Sun Oct 27 16:01:11 2013	(r257212)
+++ head/cddl/contrib/opensolaris/cmd/lockstat/sym.c	Sun Oct 27 16:18:48 2013	(r257213)
@@ -179,8 +179,19 @@ symtab_init(void)
 	size_t		sz;
 #endif
 
+#if defined(__FreeBSD__)
+	if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) {
+		if (errno == ENOENT && modfind("ksyms") == -1) {
+			kldload("ksyms");
+			fd = open("/dev/ksyms", O_RDONLY);
+		}
+		if (fd == -1)
+			return (-1);
+	}
+#else
 	if ((fd = open("/dev/ksyms", O_RDONLY)) == -1)
 		return (-1);
+#endif
 
 #if defined(sun)
 	(void) elf_version(EV_CURRENT);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310271618.r9RGImt7034934>