process sizes

Terry Lambert tlambert2 at
Sun Jul 6 09:30:47 PDT 2003

Vivek Khera wrote:
> Now, currently, the BSD code from SizeLimit reads like this:
> sub bsd_size_check {
>     return (&BSD::Resource::getrusage())[2,3];
> }
> This routine is intended to return the current process size and shared
> memory size.  However, the getrusage() above is not really doing what
> is intended.  The shared pages value returned is way wrong (only text
> pages are given by getrusage) and the current process size is not the
> MAX RSS, which is returned above.
> I'm at a loss as to what to use to measure the current process size
> and also to measure the amount of virtual memory in use by that
> process that is in shared pages.
> If anyone has good code to get this information on FreeBSD (and other
> BSD's in general) please let me know.  If additional libraries are
> needed, that's ok.  If we have to poke around /proc, that's ok to.
> I'd appreciate direct replies since I'm away at OSCON next week and
> don't want to miss anything.  Thanks.

You are aware that POSIX only requires that the struct rusage have
system and user timeval members, right?

-- Terry

More information about the freebsd-hackers mailing list