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:
markj 2017-08-01 04:49:54 +00:00
parent fac28683ec
commit d7b05ab2a8

View File

@ -194,33 +194,9 @@ symtab_init(void)
return (-1); return (-1);
#endif #endif
#ifdef illumos
(void) elf_version(EV_CURRENT); (void) elf_version(EV_CURRENT);
elf = elf_begin(fd, ELF_C_READ, NULL); 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++) { for (cnt = 1; (scn = elf_nextscn(elf, scn)) != NULL; cnt++) {
Shdr *shdr = elf_getshdr(scn); Shdr *shdr = elf_getshdr(scn);