{
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);