DragonFly BSD
DragonFly users List (threaded) for 2005-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Easy c debugging question


From: walt <wa1ter@xxxxxxxxxxxxx>
Date: Tue, 29 Mar 2005 06:09:48 -0800

I wrote this trivial c program to practice using libkinfo:

#include <sys/param.h>
#include <kinfo.h>
int main()
{
struct kinfo_cputime *k;
kinfo_get_sched_cputime(k);

printf("user=%16d\n", k->cp_user);
printf("nice=%16d\n", k->cp_nice);
printf("sys=%16d\n", k->cp_sys);
printf("intr=%16d\n", k->cp_intr);
printf("idle=%16d\n", k->cp_idle);
}

It works as I expected when compiled with dynamic linking,
but it dumps core when statically linked.  gdb tells me
it exits at the first printf with 'code 026', which means
nothing to me.

Any hints what I'm doing wrong?



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]