This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Call for testers: libiberty/physmem.c


On Fri, 21 Feb 2003, Krzysztof Parzyszek wrote:
> Here is a sample code that works on FreeBSD-STABLE.  The values returned
> by sysctl are said to be in bytes and so I don't know what happens when
> you have >= 2G of available memory.

  physmem = -140066816 bytes
  usermem = -291561472 bytes
  pagesize = 4096 bytes

With the patch at the end, it works as expected:

  physmem = 4154900480 bytes
  usermem = 4003393536 bytes
  pagesize = 4096 bytes

Gerald

--- x.c	Fri Feb 21 18:54:11 2003
+++ y.c	Fri Feb 21 18:55:10 2003
@@ -5,5 +5,5 @@
 int main() {
     int mib[2];
-    int physmem, usermem, pagesize;
+    unsigned physmem, usermem, pagesize;
     size_t len;

@@ -22,5 +22,5 @@
     if (sysctl(mib, 2, &pagesize, &len, NULL, 0) != 0) perror("sysctl");

-    printf("physmem = %d bytes\nusermem = %d bytes\npagesize = %d bytes\n",
+    printf("physmem = %u bytes\nusermem = %u bytes\npagesize = %u bytes\n",
         physmem, usermem, pagesize);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]