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

Re: Easy c debugging question


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Wed, 30 Mar 2005 04:45:30 +0200
Mail-followup-to: users@crater.dragonflybsd.org

On Tue, Mar 29, 2005 at 06:30:49PM -0800, walt wrote:
> 
> 
> On Wed, 30 Mar 2005, Joerg Sonnenberger wrote:
> 
> > On Tue, Mar 29, 2005 at 04:10:35PM -0800, Matthew Dillon wrote:
> > >     Umm.  Try the initialized pointer being passed to
> > >     kinfo_get_sched_cputime().
> 
> > Right, kinfo_get_sched_cputime(&cputime), with cputime being
> > a local variable of type struct kinfo_cputime. That's another mistake :)
> 
> You Big Kids. please take pity on us bonehead Little Kids!  Is the 'mistake'
> in my original c code?  I wouldn't doubt for a second that I made a mistake,
> (I'm quite sure I did) but I can't tell from the above just what my mistake
> was.

You should do:
	struct kinfo_cputime k;
	kinfo_get_sched_cputime(&k);

The function does not allocate the storage.

Joerg



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