changeset 14218:5c7bf99f5907

get-rusage-as: Improve on NetBSD. * lib/get-rusage-as.c (get_rusage_as_via_iterator): On NetBSD, use /proc, like on FreeBSD.
author Bruno Haible <bruno@clisp.org>
date Sun, 23 Jan 2011 20:37:48 +0100
parents 821f1ac49d4a
children eb791b56afa2
files ChangeLog lib/get-rusage-as.c
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-23  Bruno Haible  <bruno@clisp.org>
+
+	get-rusage-as: Improve on NetBSD.
+	* lib/get-rusage-as.c (get_rusage_as_via_iterator): On NetBSD, use
+	/proc, like on FreeBSD.
+
 2011-01-23  Jim Meyering  <meyering@redhat.com>
 
 	xreadlink.h: remove unnecessary #include
--- a/lib/get-rusage-as.c
+++ b/lib/get-rusage-as.c
@@ -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;