aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2013-10-27 16:18:48 +0000
committerMark Johnston <markj@FreeBSD.org>2013-10-27 16:18:48 +0000
commit5d76604145789b4624c77e8e5ddd9f9a43bc4b44 (patch)
treee04e9ec0fd78d1ebc40bd04a8d7d1b18e6dba920 /cddl/contrib
parenta10f58d076db56056d729664690a563b4627e85d (diff)
downloadsrc-5d76604145789b4624c77e8e5ddd9f9a43bc4b44.tar.gz
src-5d76604145789b4624c77e8e5ddd9f9a43bc4b44.zip
If the initial attempt to open /dev/ksyms fails, kldload the ksyms module
and retry.
Notes
Notes: svn path=/head/; revision=257213
Diffstat (limited to 'cddl/contrib')
-rw-r--r--cddl/contrib/opensolaris/cmd/lockstat/sym.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/cmd/lockstat/sym.c b/cddl/contrib/opensolaris/cmd/lockstat/sym.c
index 78b27d2bdcd2..1aa77ad3f314 100644
--- a/cddl/contrib/opensolaris/cmd/lockstat/sym.c
+++ b/cddl/contrib/opensolaris/cmd/lockstat/sym.c
@@ -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);