PAGE_SIZE patch for Debian verilog 0.8-4.1, fixing bug#411063.
If for some reason the sysconf() call fails, I think 0 is
the best possible result: it is obviously incorrect.

Steve, the same change should also be applied to 0.9.

   - Larry

--- /home/ldoolitt/deb-src/verilog-0.8/vvp/main.cc      2004-10-03 
18:10:59.000000000 -0700
+++ vvp/main.cc 2007-02-16 08:52:18.000000000 -0800
@@ -66,15 +66,17 @@
       {
            FILE *statm;
            unsigned siz, rss, shd;
+           long page_size = sysconf(_SC_PAGESIZE);
+           if (page_size==-1) page_size=0;
            statm = fopen("/proc/self/statm", "r");
            if (!statm) {
                  perror("/proc/self/statm");
                  return;
            }
            if (3<=fscanf(statm, "%u%u%u", &siz, &rss, &shd)) {
-                 a->ru_maxrss = PAGE_SIZE * siz;
-                 a->ru_idrss  = PAGE_SIZE * rss;
-                 a->ru_ixrss  = PAGE_SIZE * shd;
+                 a->ru_maxrss = page_size * siz;
+                 a->ru_idrss  = page_size * rss;
+                 a->ru_ixrss  = page_size * shd;
            }
            fclose(statm);
       }


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to