bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'get-rusage-as'


From: Bruno Haible
Subject: Re: new module 'get-rusage-as'
Date: Sun, 23 Jan 2011 20:40:14 +0100
User-agent: KMail/1.9.9

>    NetBSD:
>      a) setrlimit with RLIMIT_AS works.
>      b) No VMA iteration API exists.

Actually, on NetBSD 5.0, there is a /proc file system, like on FreeBSD.
Let's extend get_rusage_as() accordingly. In practice it makes no
difference, though, since iterating over /proc/curproc/maps yields the
same value as the setrlimit based approach.


2011-01-23  Bruno Haible  <address@hidden>

        get-rusage-as: Improve on NetBSD.
        * lib/get-rusage-as.c (get_rusage_as_via_iterator): On NetBSD, use
        /proc, like on FreeBSD.

--- lib/get-rusage-as.c.orig    Sun Jan 23 20:35:07 2011
+++ lib/get-rusage-as.c Sun Jan 23 20:34:38 2011
@@ -61,7 +61,8 @@
 
    NetBSD:
      a) setrlimit with RLIMIT_AS works.
-     b) No VMA iteration API exists.
+     b) The /proc/self/maps file contains a list of the virtual memory areas.
+     Both methods agree,
 
    OpenBSD:
      a) setrlimit exists, but RLIMIT_AS is not defined.
@@ -328,7 +329,7 @@
 
 /* Support for reading text files in the /proc file system.  */
 
-#if defined __linux__ || defined __FreeBSD__ /* || defined __CYGWIN__ */
+#if defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ /* || 
defined __CYGWIN__ */
 
 /* Buffered read-only streams.
    We cannot use <stdio.h> here, because fopen() calls malloc(), and a malloc()
@@ -462,7 +463,7 @@
   rof_close (&rof);
   return total;
 
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ || defined __NetBSD__
 
   struct rofile rof;
   int c;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]