kvm_open: kvm_nlist: No such file or directory
Luke Dean
LukeD at pobox.com
Sun Apr 20 17:56:24 UTC 2008
A few weeks ago I did a source upgrade from 6.2 to 7-STABLE. I didn't
"make delete-old" so a bunch of old libraries and such were left lying
around causing problems when I rebuilt all my ports. I'd read about some
recent improvements to DDB and SCHED_ULE in 7-STABLE, and it's a miserable
snowy weekend in Seattle right now, so I decided I'd take this opportunity
to update my system to the latest 7-STABLE and get rid of those old
libraries properly this time.
Now sysutils/wmmemmon and sysutils/wmcpuload stopped working.
Both die with:
kvm_open: kvm_nlist: No such file or directory
error extracting symbols
I found two PRs for other ports (ascpu and wmcube-gdk) to fix similar
problems, but they seem to be related to 8-CURRENT. The solution in both
of these cases is to use sysctls instead of using kvm.
PR numbers are 119923 and 120142.
My question is should the existing code work in 7-STABLE or do wmmemmon
and wmcpuload need to be changed to use sysctls?
They worked for me for a couple of weeks on 7-STABLE, but like I said, I
had old libraries lying around and some of the windowmaker stuff
chose to link to them.
I have since cleaned up my system and rebuilt (I believe) everything and
now the ports no longer work.
This is what I believe is the offending code snippet from
sysutils/wmmemmon's mem_freebsd.c file:
--------------------------------------------------------------
static kvm_t *kvm_data = NULL;
static int pageshift;
static struct nlist nlst[] = { {"_cp_time"}, {"_cnt"}, {0} };
/* initialize function */
void mem_init(void)
{
int pagesize = getpagesize();
pageshift = 0;
while (pagesize > 1) {
pageshift++;
pagesize >>= 1;
}
kvm_data = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open");
if (kvm_data == NULL) {
fprintf(stderr, "can't open kernel virtual memory");
exit(1);
}
kvm_nlist(kvm_data, nlst);
if (nlst[0].n_type == 0 || nlst[1].n_type == 0) {
fprintf(stderr, "error extracting symbols");
exit(1);
}
More information about the freebsd-stable
mailing list