summaryrefslogtreecommitdiff
path: root/lib/get-rusage-as.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-01-23 20:37:48 +0100
committerBruno Haible <bruno@clisp.org>2011-01-23 20:37:48 +0100
commit8cac6904c1eb928f5f9a7d3c6e79fd6285b08930 (patch)
treef697b3484d5190a2e4823d4f2f444624b38bed06 /lib/get-rusage-as.c
parentb1900c9d32a7175c7a5d74e15332d0c3f8a2f1f9 (diff)
downloadgnulib-8cac6904c1eb928f5f9a7d3c6e79fd6285b08930.tar.gz
get-rusage-as: Improve on NetBSD.
* lib/get-rusage-as.c (get_rusage_as_via_iterator): On NetBSD, use /proc, like on FreeBSD.
Diffstat (limited to 'lib/get-rusage-as.c')
-rw-r--r--lib/get-rusage-as.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/get-rusage-as.c b/lib/get-rusage-as.c
index 0250ce5891..80eab6a81e 100644
--- 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 @@ get_rusage_as_via_setrlimit (void)
/* 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 @@ get_rusage_as_via_iterator (void)
rof_close (&rof);
return total;
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ || defined __NetBSD__
struct rofile rof;
int c;