Re: Swap space size in C

From: Keith Thompson (kst-u_at_mib.org)
Date: 12/12/03


Date: Fri, 12 Dec 2003 22:38:31 GMT

cwomeijer@hotmail.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
>
> Otto

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) kst-u@mib.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)


Relevant Pages

  • Re: Simple question: Is there anything architecture-specific about "mkswap"?
    ... Rahul wrote: ... It's more likely to show if the platforms are really different (like ... Does "swapon" complain (and refuse to add the device/file to the ... I guess I have to phsically swap disks ...
    (comp.os.linux.misc)
  • Swap space size in C
    ... swap fileof a certain system. ... Some platforms don't seem to have any API to query this information. ... Any hints how to tack this would be very welcome ... Otto ...
    (comp.lang.c)
  • Re: More 377s heading to Southern
    ... Could it do a swap with LO at CLJ, and miss out the intermediate stops with ... short platforms on the grounds that LO serve those anyway? ...
    (uk.railway)
  • Re: Pic - Vic
    ... the fact that both platforms are signalled for bi-di working, ... never previously occurred to me that they'd swap over the lines like ... Don't they do it sometimes on quiet days to allowthe signallers ...
    (uk.railway)
  • Re: Cant Compile Stalin
    ... Recent versions of gcc require a lot more memory with high ... increasing the amount of swap space you have, ... This performs very poorly, swap is bad enough, but a swap file is ... Linux memory management lies. ...
    (comp.lang.scheme)