diff options
author | markj <markj@FreeBSD.org> | 2013-10-27 16:18:48 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2013-10-27 16:18:48 +0000 |
commit | a5afef3ae88a3ec906b42c6b1b99be6d04b8bd95 (patch) | |
tree | e04e9ec0fd78d1ebc40bd04a8d7d1b18e6dba920 /cddl | |
parent | 9d398866fde01c9c1a917c2e31a044fb0dcca5e8 (diff) | |
download | FreeBSD-src-a5afef3ae88a3ec906b42c6b1b99be6d04b8bd95.zip FreeBSD-src-a5afef3ae88a3ec906b42c6b1b99be6d04b8bd95.tar.gz |
If the initial attempt to open /dev/ksyms fails, kldload the ksyms module
and retry.
Diffstat (limited to 'cddl')
-rw-r--r-- | cddl/contrib/opensolaris/cmd/lockstat/sym.c | 11 |
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 78b27d2..1aa77ad 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); |