From 625b886e9acccfbd84f8be480ae30420a2e5b3c3 Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Thu, 30 Apr 1998 19:55:57 +0000
Subject: [PATCH] [project @ 1998-04-30 19:55:57 by sof] Opt for times() over
 getrusage() on Solaris boxes

---
 ghc/lib/std/cbits/getCPUTime.lc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ghc/lib/std/cbits/getCPUTime.lc b/ghc/lib/std/cbits/getCPUTime.lc
index d3d7b2a4895e..15488e9bf412 100644
--- a/ghc/lib/std/cbits/getCPUTime.lc
+++ b/ghc/lib/std/cbits/getCPUTime.lc
@@ -71,7 +71,14 @@ getCPUTime(StgByteArray cpuStruct)
 {
     StgInt *cpu=(StgInt *)cpuStruct;
 
-#if defined(HAVE_GETRUSAGE) && ! irix_TARGET_OS
+/* getrusage() is right royal pain to deal with when targetting multiple
+   versions of Solaris, since some versions supply it in libc (2.3 and 2.5),
+   while 2.4 has got it in libucb (I wouldn't be too surprised if it was back
+   again in libucb in 2.6..)
+
+   Avoid the problem by resorting to times() instead.
+*/
+#if defined(HAVE_GETRUSAGE) && ! irix_TARGET_OS && ! solaris2_TARGET_OS
     struct rusage t;
 
     getrusage(RUSAGE_SELF, &t);
-- 
GitLab