Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2008 16:20:42 +0100
From:      Pietro Cerutti <gahr@gahr.ch>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: more on devstat (missing include)
Message-ID:  <47A1E74A.3020003@gahr.ch>
In-Reply-To: <200801310553.59141.jhb@freebsd.org>
References:  <47A103A1.4030108@gahr.ch> <200801310553.59141.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote:
> On Wednesday 30 January 2008 06:09:21 pm Pietro Cerutti wrote:
>> Hi hackers,
>>
>> I think that i) sys/devicestat.h should include sys/resource.h or ii)
>> the man page of devstat(9) should mention that the user himself is
>> supposed to include sys/resource.h.
>>
>> Without:
>>
>>> cat devstat.c
>> #include <devstat.h>
>>
>> int main(void)
>> {
>>    devstat_getnumdevs(NULL);
>>    return (0);
>> }
>>> gcc -ldevstat -o devstat devstat.c
>> In file included from devstat.c:1:
>> /usr/include/devstat.h:131: error: 'CPUSTATES' undeclared here (not in a
>> function)
>> Exit 1
>>
>>
>> I can provide a patch if someone could tell me which one of the proposed
>> solutions above is the preferred one.
> 
> I think this might be best:
> 
> Index: devstat.h
> ===================================================================
> RCS file: /usr/cvs/src/lib/libdevstat/devstat.h,v
> retrieving revision 1.11
> diff -u -r1.11 devstat.h
> --- devstat.h   22 Jul 2005 17:19:00 -0000      1.11
> +++ devstat.h   31 Jan 2008 10:52:37 -0000
> @@ -32,6 +32,7 @@
>  #define _DEVSTAT_H
>  #include <sys/cdefs.h>
>  #include <sys/devicestat.h>
> +#include <sys/resource.h>
> 
>  #include <kvm.h>
> 
> 

Good. Are you committing that or I better send in a PR?

-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47A1E74A.3020003>