Patch for /proc/meminfo handler

Corinna Vinschen
Fri Mar 12 23:08:00 GMT 2004

On Mar 12 15:14, Andrew Klopper wrote:
> With the Cygwin 1.5.7-1 DLL, 'cat /proc/meminfo' returns an incorrect
> value for free swap space. This is most noticeable when the free virtual
> memory is less than the total physical memory, in which case the
> calculated free swap space is a negative value. This value is then
> converted to an unsigned int for display purposes, resulting in a very
> large positive number which is greater than the total amount of swap
> space.
> A patch to correct this problem is attached.

Well, that doesn't look right after applying your patch:

  $ cat /proc/meminfo
	   total:      used:      free:
  Mem:   536330240  230658048  305672192
  Swap:  770961408 4245790720  820137984
  MemTotal:         523760 kB
  MemFree:          298508 kB
  SwapTotal:        752892 kB
  SwapFree:         800916 kB

The result using the original version looks much better:

  $ cat /proc/meminfo
	   total:      used:      free:
  Mem:   536330240  231788544  304541696
  Swap:  770961408  182104064  588857344
  MemTotal:         523760 kB
  MemFree:          297404 kB
  SwapTotal:        752892 kB
  SwapFree:         575056 kB

So, perhaps both are wrong?

Please don't send patches uuencoded or in any other encoded or compressed
way.  Just add it as plain text, inline or attached.  And all patches
need a ChangeLog entry.  Have a look onto
which explains it thoroughly.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

More information about the Cygwin-patches mailing list