7101665 top crashes in getptable
authorMike Sullivan <Mike.Sullivan@Oracle.COM>
Tue, 27 Dec 2011 10:38:57 -0800
changeset 638 d348d0ea7b75
parent 637 65eb6f5145fe
child 639 faa9a904b44b
7101665 top crashes in getptable
components/top/Makefile
components/top/patches/03.sunos5.patch
components/top/patches/04.percent_cpu.patch
components/top/top.p5m
--- a/components/top/Makefile	Thu Dec 22 23:21:07 2011 +0000
+++ b/components/top/Makefile	Tue Dec 27 10:38:57 2011 -0800
@@ -42,9 +42,9 @@
 CONFIGURE_OPTIONS  +=	CFLAGS="$(CFLAGS)"
 
 # common targets
-build:		$(BUILD_32_and_64)
+build:		$(BUILD_64)
 
-install:	$(INSTALL_32_and_64)
+install:	$(INSTALL_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/top/patches/03.sunos5.patch	Thu Dec 22 23:21:07 2011 +0000
+++ b/components/top/patches/03.sunos5.patch	Tue Dec 27 10:38:57 2011 -0800
@@ -13,10 +13,10 @@
   
   	    /* read the whole file */
   	    p = malloc(st.st_size);
-! 	    if (pread(fd, p, st.st_size, 0) == -1)
+! 	    if (pread(fd, p, st.st_size, 0) != st.st_size)
 ! 	    {
 ! 		(void) close(fd);
-! 		op->fd_psinfo = -1;
+! 		op->fd_lpsinfo = -1;
 ! 		free(p);
 ! 		continue;
 ! 	    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/top/patches/04.percent_cpu.patch	Tue Dec 27 10:38:57 2011 -0800
@@ -0,0 +1,21 @@
+--- 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
--- a/components/top/top.p5m	Thu Dec 22 23:21:07 2011 +0000
+++ b/components/top/top.p5m	Tue Dec 27 10:38:57 2011 -0800
@@ -36,13 +36,9 @@
 set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
 dir path=usr
 dir path=usr/bin
-dir path=usr/bin/$(MACH32)
-dir path=usr/bin/$(MACH64)
 dir path=usr/share
 dir path=usr/share/man
 dir path=usr/share/man/man1
-file usr/bin/top path=usr/bin/$(MACH32)/top
-file path=usr/bin/$(MACH64)/top
+file usr/bin/$(MACH64)/top path=usr/bin/top
 file path=usr/share/man/man1/top.1
-hardlink path=usr/bin/top target=../lib/isaexec
 license top.license license="BSD, Apachev2.0"