Let lockstat use ksyms(4)'s mmap interface.

The workaround described in the deleted comment is no longer needed.

MFC after:	1 week
This commit is contained in:
Mark Johnston 2017-08-01 04:49:54 +00:00
parent 94759a2448
commit 90ec6fd4ba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321842

View File

@ -194,33 +194,9 @@ symtab_init(void)
return (-1);
#endif
#ifdef illumos
(void) elf_version(EV_CURRENT);
elf = elf_begin(fd, ELF_C_READ, NULL);
#else
/*
* XXX - libelf needs to be fixed so it will work with
* non 'ordinary' files like /dev/ksyms. The following
* is a work around for now.
*/
if (elf_version(EV_CURRENT) == EV_NONE) {
close(fd);
return (-1);
}
if (ioctl(fd, KIOCGSIZE, &sz) < 0) {
close(fd);
return (-1);
}
if (ioctl(fd, KIOCGADDR, &ksyms) < 0) {
close(fd);
return (-1);
}
if ((elf = elf_memory(ksyms, sz)) == NULL) {
close(fd);
return (-1);
}
#endif
for (cnt = 1; (scn = elf_nextscn(elf, scn)) != NULL; cnt++) {
Shdr *shdr = elf_getshdr(scn);