As far as I can see, I cannot read /proc/[pid]/* info using sysctl.
Then I need the other /proc/* files as well, not just /proc/sys/*
It seems to me that the sysctl interface does not have any type checking,
so if for example I want to read the jiffies counter and supply a 32-bit
field, sysctl will happily give me the first/last 32 bits of a field that
could as well be 64 bits (bit widths do sometimes change, even on architectures
that do not change). How am I to know ?
If you look in kernel/sysctl.c, you'll see code like
if (oldval && oldlenp) {
get_user(len, oldlenp);
if (len) {
if (len > table->maxlen)
len = table->maxlen;
if(copy_to_user(oldval, table->data, len))
return -EFAULT;
if(put_user(len, oldlenp))
return -EFAULT;
}
}
if (newval && newlen) {
len = newlen;
if (len > table->maxlen)
len = table->maxlen;
if(copy_from_user(table->data, newval, len))
return -EFAULT;
}
Now is that pretty or what - Imagine someone trying to configure a 64-bit
kernel parameter with a 32 bit value ;)
This could be tightened up of course - but the problem of knowing which
unit some number may be represented in is still there. For example,
assuming I could read out partition sizes, well are they in blocks, bytes,
kilobytes, or what ? Oh, I'm supposed to *know*, and *assume* such things
never change ?
-- ................................................................ : jakob@unthought.net : And I see the elder races, : :.........................: putrid forms of man : : Jakob Østergaard : See him rise and claim the earth, : : OZ9ABN : his downfall is at hand. : :.........................:............{Konkhra}...............: - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/