Re: trouble getting memory and swap info
On Thu, 28 Oct 2004, Joerg Sonnenberger wrote:
> On Thu, Oct 28, 2004 at 02:17:03AM +0200, Sten Spans wrote:
>> On fbsd4 and probably dragonfly a program needs
>> setgid kmem for certain memory statistics, which is
>> why top works and gkrellm doesn't.
>
> If you have details to which statistics are only available via kmem
> and not by sysctl, tell me. We can easily add sysctl handlers for them
> and remove the setgid kmem requirement from top and other such tools.
> I don't like the idea of userland reading kernel memory directly at all.
The main bugbear is kvm_getswapinfo aka :
kvm_getswapinfo(kd, swapary, 1, 0);
data->swap_stats[0] = pagetob(swapary[0].ksw_total);
data->swap_stats[1] = pagetob(swapary[0].ksw_used);
data->swap_stats[2] = pagetob(swapary[0].ksw_total - swapary[0].ksw_used);
( this comes from my trivial tcp system statistics program,
http://viewcvs.blinkenlights.nl/index.cgi/monitor/ )
--
Sten Spans
"There is a crack in everything, that's how the light gets in."
Leonard Cohen - Anthem
討論串 (同標題文章)
完整討論串 (本文為第 8 之 8 篇):