changeset 38920:4098349dde39

get-rusage-as: Avoid crash on Haiku.
author Bruno Haible <bruno@clisp.org>
date Sun, 29 Oct 2017 14:33:52 +0100
parents b8611026be0c
children 8c3c1dae80c7
files ChangeLog lib/get-rusage-as.c
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 29 12:57:35 2017 +0100
+++ b/ChangeLog	Sun Oct 29 14:33:52 2017 +0100
@@ -1,3 +1,8 @@
+2017-10-29  Bruno Haible  <bruno@clisp.org>
+
+	get-rusage-as: Avoid crash on Haiku.
+	* lib/get-rusage-as.c: Avoid the setlimit-based implementation.
+
 2017-10-29  Bruno Haible  <bruno@clisp.org>
 
 	ilogbl: Ensure replacement on Haiku.
--- a/lib/get-rusage-as.c	Sun Oct 29 12:57:35 2017 +0100
+++ b/lib/get-rusage-as.c	Sun Oct 29 14:33:52 2017 +0100
@@ -112,7 +112,7 @@
 
    BeOS, Haiku:
      a) On BeOS, there is no setrlimit function.
-        On Haiku, setrlimit exists. RLIMIT_AS is defined but unsupported.
+        On Haiku, setrlimit exists. RLIMIT_AS is defined but setrlimit fails.
      b) There is a specific BeOS API: get_next_area_info().
  */
 
@@ -150,7 +150,7 @@
 #include "vma-iter.h"
 
 
-#if HAVE_SETRLIMIT && defined RLIMIT_AS && HAVE_SYS_MMAN_H && HAVE_MPROTECT
+#if HAVE_SETRLIMIT && defined RLIMIT_AS && HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __HAIKU__
 
 static uintptr_t
 get_rusage_as_via_setrlimit (void)
@@ -365,7 +365,7 @@
   /* get_rusage_as_via_setrlimit() does not work.
      Prefer get_rusage_as_via_iterator().  */
   return get_rusage_as_via_iterator ();
-#elif HAVE_SETRLIMIT && defined RLIMIT_AS && HAVE_SYS_MMAN_H && HAVE_MPROTECT
+#elif HAVE_SETRLIMIT && defined RLIMIT_AS && HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __HAIKU__
   /* Prefer get_rusage_as_via_setrlimit() if it succeeds,
      because the caller may want to use the result with setrlimit().  */
   uintptr_t result;