Re: An alternative way of populating /proc

From: Jeremy Fitzhardinge (jeremy@goop.org)
Date: Wed Apr 12 2000 - 15:43:37 EST


On 12-Apr-2000 dean gaudet wrote:
> On Tue, 11 Apr 2000, Matt Aubury wrote:
>
>> The recent debate about the multitude of possible formats for data in
>> /proc caused me to think about a short-hand way of populating a /proc
>> directory hierarchy. This scheme uses a format string to describe the
>> hierarchical data layout, so:
>>
>> create_proc_entries(NULL,
>> "test:{bar:{x:%d,y:%d,z:%d},foo:%f}",
>> &x, &y, &z, foo_fun);
>
> printf-style stuff sucks whenever you use more abstract types. for
> example, try to printf() an off_t... there's no portable way to do it.
> %u is right on some unixes, %qu on others. you have to resort to
> autoconf
> or other config time tricks to create some garbage like:

There's a better solution, at least for C89: cast to long, and always use
%ld. Drat, looks like the new standard broke perfectly some good code
with long long again.

        J

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:19 EST