From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.)
Subject: Re: How to check swap space from C
Date: 22 Nov 1994 03:02:12 GMT [thread overview]
Message-ID: <3armvk$gms@nntpd2.cxo.dec.com> (raw)
In-Reply-To: 3ar8hg$ov6@loach.cichlid.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]
In article <3ar8hg$ov6@loach.cichlid.com>, aab@cichlid.com (Andy Burgess) writes:
>Does anyone know how to determine free swap space from C code on any of the
>following platforms:
>
>dec: ULTRIX 4.4
I've seen two algorithms used:
1. You need to read the resource map for the "swapmap"�and then add
up the size for each element.
2. There is a data structure called swapu, defined in <sys/dmap.h>.
This keeps track of how the swap space is used. One of the
fields is the total in use. The amount free is the total
available - total_used. The amount available is the sum of
sizes in swdevt table.
Finally, ULTRIX keeps track of two things; the amount reserved and
the amount in use. When a process wants virtual memory, it has
to reserve the amount it wants. If there isn't enough available,
then whatever was trying to get the memory gets ENOMEM or the
equivalent. But, no space actually gets allocated, until the
process wants to page.
The number you want is probably the different in the total available
and the amount reserved. Again, see <sys/dmap.h>.
>
>
>Andrew A. Burgess aab@cichlid.com
>
--
Alan Rollow alan@nabeth.cxo.dec.com
next prev parent reply other threads:[~1994-11-22 3:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-11-21 22:55 How to check swap space from C Andy Burgess
1994-11-22 3:02 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. [this message]
1994-11-24 0:37 ` Barry Kort
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox