Re: Swap space size in C
From: Keith Thompson (kst-u_at_mib.org)
Date: Fri, 12 Dec 2003 22:38:31 GMT
email@example.com (Otto Meijer) writes:
> Hi everyone,
> for one of my projects I need to figure out the size of the
> swap file(s) of a certain system. The problem is I need to do this
> on a host of platforms like: HP_UX, Solaris, Linux, AIX, OSF,
> OpenVMS and Windows.
> This seems much more difficult than I thought origionaly.
> Some platforms don't seem to have any API to query this information.
> Any hints how to tack this would be very welcome
As others have mentioned, this is extremely platform-specific. It may
not even be possible on some platforms. Some platforms may not have a
concept of a "swap file" (it could be a swap partition, for example);
others could have a "swap file" whose size can vary over time, or that
doesn't have a well-defined size at all.
You might want to reconsider whether knowing the "size" of the "swap
file" is even useful. What are you going to do with the information?
(That's a rhetorical question; any answer is probably off-topic here.)
-- Keith Thompson (The_Other_Keith) firstname.lastname@example.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst> Schroedinger does Shakespeare: "To be *and* not to be" (Note new e-mail address)