components/top/patches/04.percent_cpu.patch
author Jan Noha <jan.noha@oracle.com>
Thu, 24 Apr 2014 17:36:25 +0200
branchs11u2-sru
changeset 3388 68cefdb716e2
parent 638 d348d0ea7b75
child 1134 9b5eb03884b6
permissions -rw-r--r--
18385582 compress/gzip package bringing in extra dependancies with fix for 15440739

--- top-3.8beta1/machine/m_sunos5.c.orig	Tue Nov  8 11:23:08 2011
+++ top-3.8beta1/machine/m_sunos5.c	Tue Nov  8 11:23:11 2011
@@ -152,8 +152,17 @@
  * one of the spare slots in the prinfo structure.
  */
 
-#define percent_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[0]))
+#if OSREV > 59
+/* 
+ * on Solaris 10, psinfo.pr_filler is 4 bytes and not double-aligned, so we must * move our scratch space to the larger pr.lwp_pr_filler which is 20 bytes
+ * XXX this is a time bomb and will likely break in future Solaris releases.
+ */
+#define percent_cpu(pp) (*(double *)dbl_align(&pp->pr_lwp.pr_filler[0]))
+#else
+#define percent_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[0]))
+#endif
 
+
 /* definitions for indices in the nlist array */
 #define X_V			 0
 #define X_MPID			 1