# This patch was developed in-house. Since it is Solaris-specific,
# it is not suitable for upstream.
#
diff -r -u /tmp/infiniband-diags-1.5.8/Makefile.am infiniband-diags-1.5.8/Makefile.am
--- /tmp/infiniband-diags-1.5.8/Makefile.am	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/Makefile.am	Fri Feb 25 03:09:22 2011
@@ -13,7 +13,7 @@
 sbin_PROGRAMS = src/ibaddr src/ibnetdiscover src/ibping src/ibportstate \
 	        src/ibroute src/ibstat src/ibsysstat src/ibtracert \
 	        src/perfquery src/sminfo src/smpdump src/smpquery \
-	        src/saquery src/vendstat src/iblinkinfo \
+	        src/saquery src/vendstat src/solaris_set_nodedesc src/iblinkinfo \
 		src/ibqueryerrors src/ibcacheedit
 
 if ENABLE_TEST_UTILS
@@ -44,7 +44,7 @@
 libcommon_a_SOURCES = src/ibdiag_common.c
 src_ibaddr_SOURCES = src/ibaddr.c
 src_ibnetdiscover_SOURCES = src/ibnetdiscover.c
-src_ibnetdiscover_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc
+src_ibnetdiscover_LDFLAGS =
 src_ibping_SOURCES = src/ibping.c
 src_ibportstate_SOURCES = src/ibportstate.c
 src_ibroute_SOURCES = src/ibroute.c
@@ -66,6 +66,9 @@
 src_ibcacheedit_SOURCES = src/ibcacheedit.c
 src_ibcacheedit_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc
 
+src_solaris_set_nodedesc_SOURCES = src/solaris_set_nodedesc.c
+src_solaris_set_nodedesc_CFLAGS = -Wall $(DBGFLAGS)
+
 man_MANS = man/ibaddr.8 man/ibcheckerrors.8 man/ibcheckerrs.8 \
 	man/ibchecknet.8 man/ibchecknode.8 man/ibcheckport.8 \
 	man/ibcheckportstate.8 man/ibcheckportwidth.8 man/ibcheckstate.8 \
diff -r -u /tmp/infiniband-diags-1.5.8/Makefile.in infiniband-diags-1.5.8/Makefile.in
--- /tmp/infiniband-diags-1.5.8/Makefile.in	Wed Feb 16 02:28:20 2011
+++ infiniband-diags-1.5.8/Makefile.in	Fri Feb 25 03:21:49 2011
@@ -44,7 +44,8 @@
 	src/smpdump$(EXEEXT) src/smpquery$(EXEEXT) \
 	src/saquery$(EXEEXT) src/vendstat$(EXEEXT) \
 	src/iblinkinfo$(EXEEXT) src/ibqueryerrors$(EXEEXT) \
-	src/ibcacheedit$(EXEEXT) $(am__EXEEXT_1)
+	src/ibcacheedit$(EXEEXT) $(am__EXEEXT_1) \
+	src/solaris_set_nodedesc$(EXEEXT)
 @ENABLE_TEST_UTILS_TRUE@am__append_1 = src/ibsendtrap src/mcm_rereg_test
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
@@ -190,6 +191,11 @@
 src_vendstat_OBJECTS = $(am_src_vendstat_OBJECTS)
 src_vendstat_LDADD = $(LDADD)
 src_vendstat_DEPENDENCIES = libcommon.a
+am_src_solaris_set_nodedesc_OBJECTS = src_solaris_set_nodedesc-solaris_set_nodedesc.$(OBJEXT) \
+	src_solaris_set_nodedesc-ibdiag_common.$(OBJEXT)
+src_solaris_set_nodedesc_OBJECTS = $(am_src_solaris_set_nodedesc_OBJECTS)
+src_solaris_set_nodedesc_LDADD = $(LDADD)
+sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) -m 755
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -234,7 +240,8 @@
 	$(src_ibtracert_SOURCES) $(src_mcm_rereg_test_SOURCES) \
 	$(src_perfquery_SOURCES) $(src_saquery_SOURCES) \
 	$(src_sminfo_SOURCES) $(src_smpdump_SOURCES) \
-	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES)
+	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES) \
+	$(src_solaris_set_nodedesc_SOURCES)
 DIST_SOURCES = $(libcommon_a_SOURCES) $(src_ibaddr_SOURCES) \
 	$(src_ibcacheedit_SOURCES) $(src_iblinkinfo_SOURCES) \
 	$(src_ibnetdiscover_SOURCES) $(src_ibping_SOURCES) \
@@ -244,7 +251,8 @@
 	$(src_ibtracert_SOURCES) $(src_mcm_rereg_test_SOURCES) \
 	$(src_perfquery_SOURCES) $(src_saquery_SOURCES) \
 	$(src_sminfo_SOURCES) $(src_smpdump_SOURCES) \
-	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES)
+	$(src_smpquery_SOURCES) $(src_vendstat_SOURCES) \
+	$(src_solaris_set_nodedesc_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	install-dvi-recursive install-exec-recursive \
@@ -252,7 +260,11 @@
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
-man8dir = $(mandir)/man8
+src_solaris_set_nodedesc_SOURCES = src/solaris_set_nodedesc.c src/ibdiag_common.c
+src_solaris_set_nodedesc_CFLAGS = -Wall $(DBGFLAGS)
+src_solaris_set_nodedesc_LDFLAGS =
+
+man8dir = $(mandir)/man1m
 NROFF = nroff
 MANS = $(man_MANS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
@@ -610,8 +622,8 @@
 	while read type dir files; do \
 	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
 	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
 	    } \
 	; done
 
@@ -633,6 +645,13 @@
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
+
+clean-sbinSCRIPTS:
+	@list=`ls scripts/*.in`; for p in $$list; do \
+	  f=`echo $$p | sed 's/\.in//'`; \
+	  echo " rm -f $$f"; \
+	  rm -f $$f ; \
+	done
 src/$(am__dirstamp):
 	@$(MKDIR_P) src
 	@: > src/$(am__dirstamp)
@@ -693,6 +712,10 @@
 src/vendstat$(EXEEXT): $(src_vendstat_OBJECTS) $(src_vendstat_DEPENDENCIES) src/$(am__dirstamp)
 	@rm -f src/vendstat$(EXEEXT)
 	$(LINK) $(src_vendstat_OBJECTS) $(src_vendstat_LDADD) $(LIBS)
+	$(LINK) $(src_vendstat_OBJECTS) $(src_vendstat_LDADD) $(LIBS)
+src/solaris_set_nodedesc$(EXEEXT): $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_DEPENDENCIES) src/$(am__dirstamp)
+	@rm -f src/solaris_set_nodedesc$(EXEEXT)
+	$(LINK) $(src_solaris_set_nodedesc_LDFLAGS) $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_LDADD) $(LIBS)
 install-sbinSCRIPTS: $(sbin_SCRIPTS)
 	@$(NORMAL_INSTALL)
 	test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
@@ -754,6 +777,8 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpdump.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpquery.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vendstat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -1056,6 +1081,34 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vendstat.obj `if test -f 'src/vendstat.c'; then $(CYGPATH_W) 'src/vendstat.c'; else $(CYGPATH_W) '$(srcdir)/src/vendstat.c'; fi`
 
+src_solaris_set_nodedesc-solaris_set_nodedesc.o: src/solaris_set_nodedesc.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-solaris_set_nodedesc.o -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/solaris_set_nodedesc.c' object='src_solaris_set_nodedesc-solaris_set_nodedesc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c
+
+src_solaris_set_nodedesc-solaris_set_nodedesc.obj: src/solaris_set_nodedesc.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-solaris_set_nodedesc.obj -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-solaris_set_nodedesc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/solaris_set_nodedesc.c' object='src_solaris_set_nodedesc-solaris_set_nodedesc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`
+
+src_solaris_set_nodedesc-ibdiag_common.o: src/ibdiag_common.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-ibdiag_common.o -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" -c -o src_solaris_set_nodedesc-ibdiag_common.o `test -f 'src/ibdiag_common.c' || echo '$(srcdir)/'`src/ibdiag_common.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/ibdiag_common.c' object='src_solaris_set_nodedesc-ibdiag_common.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-ibdiag_common.o `test -f 'src/ibdiag_common.c' || echo '$(srcdir)/'`src/ibdiag_common.c
+
+src_solaris_set_nodedesc-ibdiag_common.obj: src/ibdiag_common.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -MT src_solaris_set_nodedesc-ibdiag_common.obj -MD -MP -MF "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" -c -o src_solaris_set_nodedesc-ibdiag_common.obj `if test -f 'src/ibdiag_common.c'; then $(CYGPATH_W) 'src/ibdiag_common.c'; else $(CYGPATH_W) '$(srcdir)/src/ibdiag_common.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo" "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Po"; else rm -f "$(DEPDIR)/src_solaris_set_nodedesc-ibdiag_common.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/ibdiag_common.c' object='src_solaris_set_nodedesc-ibdiag_common.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_solaris_set_nodedesc_CFLAGS) $(CFLAGS) -c -o src_solaris_set_nodedesc-ibdiag_common.obj `if test -f 'src/ibdiag_common.c'; then $(CYGPATH_W) 'src/ibdiag_common.c'; else $(CYGPATH_W) '$(srcdir)/src/ibdiag_common.c'; fi`
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -1080,6 +1133,10 @@
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
 	sed 'N;N;s,\n, ,g' | { \
 	list=; while read file base inst; do \
+	  ext='1m'; \
+	  inst=`echo $$inst | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
 	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
 	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
 	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
@@ -1100,6 +1157,10 @@
 	  sed -n '/\.8[a-z]*$$/p'; \
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	ext='1m'; \
+	files=`echo $$files | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	files=`echo $$files | sed -e 's/^.*\///'`; \
+	files=`echo $$files | sed '$(transform)'`.$$ext; \ 
 	test -z "$$files" || { \
 	  echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
 	  cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
@@ -1470,7 +1531,7 @@
 clean: clean-recursive
 
 clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
-	clean-sbinPROGRAMS mostlyclean-am
+	clean-sbinPROGRAMS clean-sbinSCRIPTS mostlyclean-am
 
 distclean: distclean-recursive
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -1551,7 +1612,8 @@
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES clean-sbinPROGRAMS ctags \
+	clean-libtool clean-noinstLIBRARIES clean-sbinPROGRAMS \
+	clean-sbinSCRIPTS ctags \
 	ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
 	dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
 	distclean distclean-compile distclean-generic distclean-hdr \
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckportstate.in infiniband-diags-1.5.8/scripts/ibcheckportstate.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibcheckportstate.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibcheckportstate.in	Thu Feb 24 11:26:53 2011
@@ -73,7 +73,7 @@
 portnum=$2
 
 if [ "$guid_addr" ]; then
-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
 		echo -n "guid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -81,7 +81,7 @@
 	guid=$1
 else
 	lid=$1
-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
 		echo -n "lid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -91,7 +91,7 @@
 
 text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
 rv=$?
-if echo "$text" | awk -v mono=$bw -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
 function blue(s)
 {
 	if (mono)
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibhosts.in infiniband-diags-1.5.8/scripts/ibhosts.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibhosts.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibhosts.in	Thu Feb 24 11:26:56 2011
@@ -49,7 +49,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 /^Ca/	{print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
 		substr($0, match($0, "#[ \t]*")+RLENGTH)}
 /^ib/	{print $0; next}
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/set_nodedesc.sh infiniband-diags-1.5.8/scripts/set_nodedesc.sh
--- /tmp/infiniband-diags-1.5.8/scripts/set_nodedesc.sh	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/set_nodedesc.sh	Fri Feb 25 03:09:27 2011
@@ -1,5 +1,13 @@
 #!/bin/bash
 
+# Call solaris_set_nodedesc, if operating system is SunOS
+os=`uname -s`
+if [ $os == "SunOS" ]; then
+	solaris_set_nodedesc "$@"
+	rc=$?
+	exit $rc
+fi
+
 if [ -f /etc/sysconfig/network ]; then
 . /etc/sysconfig/network
 fi
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibchecknode.in infiniband-diags-1.5.8/scripts/ibchecknode.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibchecknode.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibchecknode.in	Thu Feb 24 11:26:52 2011
@@ -71,7 +71,7 @@
 fi
 
 if [ "$guid_addr" ]; then
-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
 		echo -n "guid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -78,7 +78,7 @@
 	fi
 else
 	lid=$1
-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
 		echo -n "lid $1 address resolution: "
 		red "FAILED"
 		exit -1
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckstate.in infiniband-diags-1.5.8/scripts/ibcheckstate.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibcheckstate.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibcheckstate.in	Thu Feb 24 11:26:53 2011
@@ -69,7 +69,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 BEGIN {
 	ne=0
 	pe=0
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibswitches.in infiniband-diags-1.5.8/scripts/ibswitches.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibswitches.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibswitches.in	Thu Feb 24 11:26:58 2011
@@ -49,7 +49,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 /^Switch/	{
 			l=$0
 			desc=substr(l, match(l, "#[ \t]*")+RLENGTH)
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibclearcounters.in infiniband-diags-1.5.8/scripts/ibclearcounters.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibclearcounters.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibclearcounters.in	Thu Feb 24 11:26:54 2011
@@ -59,7 +59,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 
 function clear_counters(lid)
 {
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrors.in infiniband-diags-1.5.8/scripts/ibcheckerrors.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrors.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibcheckerrors.in	Thu Feb 24 11:26:52 2011
@@ -74,7 +74,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 BEGIN {
 	ne=0
 }
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibprintswitch.pl infiniband-diags-1.5.8/scripts/ibprintswitch.pl
--- /tmp/infiniband-diags-1.5.8/scripts/ibprintswitch.pl	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibprintswitch.pl	Thu Feb 24 11:26:57 2011
@@ -84,7 +84,7 @@
 
 if ($list_switches) {
 	system("ibswitches $cache_file");
-	exit 1;
+	exit $?;
 }
 
 if ($target_switch eq "") {
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibprintrt.pl infiniband-diags-1.5.8/scripts/ibprintrt.pl
--- /tmp/infiniband-diags-1.5.8/scripts/ibprintrt.pl	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibprintrt.pl	Thu Feb 24 11:26:57 2011
@@ -84,7 +84,7 @@
 
 if ($list_rts) {
 	system("ibrouters $cache_file");
-	exit 1;
+	exit $?;
 }
 
 if ($target_rt eq "") {
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibclearerrors.in infiniband-diags-1.5.8/scripts/ibclearerrors.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibclearerrors.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibclearerrors.in	Thu Feb 24 11:26:54 2011
@@ -63,7 +63,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 
 function clear_all_errors(lid, port)
 {
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibdatacounters.in infiniband-diags-1.5.8/scripts/ibdatacounters.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibdatacounters.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibdatacounters.in	Thu Feb 24 11:26:54 2011
@@ -74,7 +74,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 BEGIN {
 	ne=0
 }
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrs.in infiniband-diags-1.5.8/scripts/ibcheckerrs.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibcheckerrs.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibcheckerrs.in	Fri Feb 25 03:09:27 2011
@@ -136,7 +136,7 @@
 fi
 
 if [ "$guid_addr" ]; then
-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
 		echo -n "guid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -144,7 +144,7 @@
 	guid=$1
 else
 	lid=$1
-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
 		echo -n "lid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -163,7 +163,7 @@
 	exit 0
 fi
 
-if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
 function blue(s)
 {
 	if (brief == "yes") {
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibrouters.in infiniband-diags-1.5.8/scripts/ibrouters.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibrouters.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibrouters.in	Thu Feb 24 11:26:57 2011
@@ -49,7 +49,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 /^Rt/	{print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
 		substr($0, match($0, "#[ \t]*")+RLENGTH)}
 /^ib/	{print $0; next}
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibstatus infiniband-diags-1.5.8/scripts/ibstatus
--- /tmp/infiniband-diags-1.5.8/scripts/ibstatus	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibstatus	Fri Feb 25 03:09:27 2011
@@ -2,8 +2,9 @@
 
 # Usage ibstatus [devname[:port]]
 
-infiniband_base="/sys/class/infiniband"
-def_ibdev="mthca0"
+ibvdevinfo="/usr/bin/ibv_devinfo"
+ibvdevinfo_results="/tmp/ibvdevinfo.output.$$"
+tmpout="/tmp/tmpout.$$"
 
 usage() {
 	prog=`basename $0`
@@ -10,58 +11,128 @@
 	echo "Usage: " $prog " [-h] [devname[:portnum]]"
 	echo "	-h:	this help screen"
 	echo "	Examples:"
-	echo "		$prog mthca1		# shows status of all ports of 'mthca1'"
-	echo "		$prog mthca0:2	# shows status port number 2 of 'mthca0'"
-	echo "		$prog		# default: shows status of all '$def_ibdev' ports"
-	exit -1
+	echo "		$prog mlx4_1		# shows status of all ports of 'mlx4_1'"
+	echo "		$prog mlx4_0:2	# shows status port number 2 of 'mlx4_0'"
+	echo "		$prog		# default: shows status of all IB ports"
+	exit 0
 }
 
-fatal() {
-	echo "Fatal error: " $*
-	exit -1
+get_status_ports() {
+	nawk '
+	BEGIN {
+		hcaid_in="'"$1"'"
+		port_in="'"$2"'"
+		if (hcaid_in == "+") {
+			hcaid_hit=1
+			if (port_in == "+")
+				port_hit=1
+		}
+	}
+	{
+		if ($0 ~ "hca_id") {
+			if (hcaid_in == "+") {
+				cur_hcaid = $2
+			} else if (hcaid_in == $2) {
+				hcaid_hit=1
+				if (port_in == "+")
+					port_hit=1
+			} else if (hcaid_hit == 1)
+				exit 0
+		}
+		if (hcaid_hit == 1) {
+			if ($0 ~ "port:") {
+				if (port_in == "+") {
+					cur_port=$2;
+				} else if (port_in == $2) {
+					port_hit=1
+				} else if (port_hit == 1)
+					exit 0
+			}
+		}
+		if (hcaid_hit == 1 && port_hit == 1) {
+			if ($0 ~ "state:" && $0 !~ "phys_state:") {
+				state=$2;
+				staten=$3
+			} else if ($0 ~ "sm_lid:") {
+				sm_lid=$2
+			} else if ($0 ~ "port_lid:") {
+				port_lid=$2
+			} else if ($0 ~ "active_width:") {
+				width = $2
+				sub("X$", "", width)
+			} else if ($0 ~ "active_speed:") {
+				speed=$2
+			} else if ($0 ~ "phys_state:") {
+				pstate=$2
+				pstaten=$3
+			} else if ($0 ~ "link_layer:") {
+				link=$2
+			} else if ($0 ~ "GID"){
+				gid=$NF
+				if (hcaid_in == "+") {
+					printf("Infiniband device '\''%s'\'' port %d status:\n", cur_hcaid, cur_port);
+				} else if (port_in == "+") {
+					printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, cur_port);
+				} else {
+					printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, port_in);
+				}
+				printf("\tdefault gid:\t%s\n", gid)
+				printf("\tstate:\t\t%d: %s\n", staten, state); 
+				printf("\tphys state:\t%d: %s\n", pstaten, pstate);
+				printf("\tsm lid:\t\t0x%x\n", sm_lid)
+				printf("\tbase lid:\t0x%x\n", port_lid)
+				printf("\trate:\t\t%d Gb/sec (%dX)\n", width * speed, width)
+				printf("\tlink_layer:\t%s\n\n", link); 
+			}
+		}
+	}
+	END {
+		if (hcaid_in != "+" && port_in == "+" && hcaid_hit == 0) {
+ 			printf("Fatal error: device '\''%s'\'' not found\n\n", hcaid_in)
+			exit 1;
+		}
+		if (hacid_in != "+" && port_in != "+" && port_hit == 0) {
+ 			printf("Fatal error: port '\''%s:%d'\'' not found\n\n", hcaid_in, port_in)
+			exit 1;
+		}
+	}' $tmpout
 }
 
+if [ "$1" = "-h" ]; then
+	usage
+fi
 
-port_status() {
-	port_dir="$infiniband_base/$1/ports/$2"
-	echo "Infiniband device '$1' port $2 status:"
-	echo "	default gid:	" `[ -r $port_dir/gids/0 ] && cat $port_dir/gids/0 || echo unknown`
-	echo "	base lid:	" `[ -r $port_dir/lid ] && cat $port_dir/lid || echo unknown`
-	echo "	sm lid:		" `[ -r $port_dir/sm_lid ] && cat $port_dir/sm_lid || echo unknown`
-	echo "	state:		" `[ -r $port_dir/state ] && cat $port_dir/state || echo unknown`
-	echo "	phys state:	" `[ -r $port_dir/phys_state ] && cat $port_dir/phys_state || echo unknown`
-	echo "	rate:		" `[ -r $port_dir/rate ] && cat $port_dir/rate || echo unknown`
-	echo "	link_layer:	" `[ -r $port_dir/link_layer ] && cat $port_dir/link_layer || echo IB`
-	echo
-}
+# Check to see if /usr/bin/ibv_devinfo exists.
+if [ ! -x $ibvdevinfo ]; then
+	echo "$ibvdevinfo doesn't exist!"
+	exit 1
+fi
 
-ib_status() {
-	ports_dir="$infiniband_base/$1/ports"
+# Run ibv_devinfo and direct the output to $ibvdevinfo_results.
+$ibvdevinfo -v > $ibvdevinfo_results
+if [ $? != 0 ]; then
+	echo "$ibvdevinfo failed!"
+	exit 1
+fi
+#
 
-	if ! [ -d "$ports_dir" ]; then
-		fatal "device '$1': sys files not found ($ports_dir)"
-	fi
-
-	if [ "$2" = "+" ]; then
-		ports=`(cd "$infiniband_base/$1/ports" 2>/dev/null || fatal No devices; echo *)`
-	else
-		ports=$2
-	fi
-
-	for i in $ports; do
-		port_status $1 $i
-	done
-}
-
-if [ "$1" = "-h" ]; then
-	usage
+nhcas=`$ibvdevinfo -l | awk '/HCA/{print $1}'`
+if [ -z $nhcas ]; then
+        echo "No HCAs!"
+	rm -f $ibvdevinfo_results
+	exit 1
 fi
 
+egrep "port:|hca_id:|_lid|GID|state:|active_|link_layer:" $ibvdevinfo_results |grep -v _mtu | sed -e 's/(//' -e 's/)//' > $tmpout
+rm -f $ibvdevinfo_results
+
 if [ -z "$1" ]; then
-	cd $infiniband_base 2>/dev/null || fatal No devices
-	for dev in *; do
-		ib_status $dev "+";
-	done
+	get_status_ports "+" "+"
+	if [ $? != 0 ]; then
+		rm -f $tmpout
+		exit 1
+	fi
+	rm -f $tmpout
 	exit 0
 fi
 
@@ -73,6 +144,12 @@
 		port="+"
 	fi
 
-	ib_status $dev $port
+	get_status_ports $dev $port
+	if [ $? != 0 ]; then
+		rm -f $tmpout
+		exit 1
+	fi
+
 	shift
 done
+rm -f $tmpout
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckwidth.in infiniband-diags-1.5.8/scripts/ibcheckwidth.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibcheckwidth.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibcheckwidth.in	Thu Feb 24 11:26:54 2011
@@ -69,7 +69,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 BEGIN {
 	ne=0
 	pe=0
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckportwidth.in infiniband-diags-1.5.8/scripts/ibcheckportwidth.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibcheckportwidth.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibcheckportwidth.in	Thu Feb 24 11:26:53 2011
@@ -73,7 +73,7 @@
 portnum=$2
 
 if [ "$guid_addr" ]; then
-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
 		echo -n "guid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -81,7 +81,7 @@
 	guid=$1
 else
 	lid=$1
-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
 		echo -n "lid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -91,7 +91,7 @@
 
 text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
 rv=$?
-if echo "$text" | awk -v mono=$bw -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
 function blue(s)
 {
 	if (mono)
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibdatacounts.in infiniband-diags-1.5.8/scripts/ibdatacounts.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibdatacounts.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibdatacounts.in	Thu Feb 24 11:26:55 2011
@@ -91,7 +91,7 @@
 fi
 
 if [ "$guid_addr" ]; then
-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
 		echo -n "guid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -99,7 +99,7 @@
 	guid=$1
 else
 	lid=$1
-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
 		echo -n "lid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -110,7 +110,7 @@
 
 text="`eval $IBPATH/perfquery $ca_info $lid $portnum`"
 rv=$?
-if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
 function blue(s)
 {
 	if (brief == "yes") {
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibprintca.pl infiniband-diags-1.5.8/scripts/ibprintca.pl
--- /tmp/infiniband-diags-1.5.8/scripts/ibprintca.pl	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibprintca.pl	Thu Feb 24 11:26:57 2011
@@ -84,7 +84,7 @@
 
 if ($list_hcas) {
 	system("ibhosts $cache_file");
-	exit 1;
+	exit $?;
 }
 
 if ($target_hca eq "") {
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/IBswcountlimits.pm infiniband-diags-1.5.8/scripts/IBswcountlimits.pm
--- /tmp/infiniband-diags-1.5.8/scripts/IBswcountlimits.pm	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/IBswcountlimits.pm	Thu Jun 30 13:22:36 2011
@@ -261,7 +261,8 @@
 	my $cache_file   = get_cache_file($ca_name, $ca_port);
 	my $extra_params = get_ca_name_port_param_string($ca_name, $ca_port);
 
-	if (`ibnetdiscover -g $extra_params > $cache_file`) {
+	my $rc = `ibnetdiscover -g $extra_params > $cache_file`;
+	if ("$?" ne "0") {
 		die "Execution of ibnetdiscover failed: $!\n";
 	}
 }
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibcheckport.in infiniband-diags-1.5.8/scripts/ibcheckport.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibcheckport.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibcheckport.in	Thu Feb 24 11:26:53 2011
@@ -73,7 +73,7 @@
 portnum=$2
 
 if [ "$guid_addr" ]; then
-	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+	if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
 		echo -n "guid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -81,7 +81,7 @@
 	guid=$1
 else
 	lid=$1
-	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+	if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
 		echo -n "lid $1 address resolution: "
 		red "FAILED"
 		exit -1
@@ -91,7 +91,7 @@
 
 text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
 rv=$?
-if echo "$text" | awk -v mono=$bw -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
 function blue(s)
 {
 	if (mono)
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibdiscover.pl infiniband-diags-1.5.8/scripts/ibdiscover.pl
--- /tmp/infiniband-diags-1.5.8/scripts/ibdiscover.pl	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibdiscover.pl	Thu Feb 24 11:26:55 2011
@@ -49,9 +49,10 @@
 		$localGuid = $local;
 	} else {
 		($localPort, $type, $remoteGuid, $remotePort) =
-		  /([\s\S]*)"([SH])\-000([a-f\d]*)"([\s\S]*)\n/;
+		  /([\s\S]*)"([SH])\-([a-f\d]*)"([\s\S]*)\n/;
 		($localPort)  = $localPort  =~ /\[(\d*)]/;
 		($remotePort) = $remotePort =~ /\[(\d*)]/;
+		$remoteGuid =~ s/^0*//;
 		if ($remoteGuid ne "" && $localPort ne "") {
 			printf(TOPO2 "%d|%s|%d|%s\n",
 				$localPort, $localGuid, $remotePort, $remoteGuid);
diff -r -u /tmp/infiniband-diags-1.5.8/scripts/ibchecknet.in infiniband-diags-1.5.8/scripts/ibchecknet.in
--- /tmp/infiniband-diags-1.5.8/scripts/ibchecknet.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/scripts/ibchecknet.in	Thu Feb 24 11:26:52 2011
@@ -67,7 +67,7 @@
 
 text="`eval $netcmd`"
 rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
 BEGIN {
 	ne=0
 	pe=0
diff -r -u /tmp/infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c
--- /tmp/infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/libibnetdisc/src/query_smp.c	Thu May  5 15:26:22 2011
@@ -160,7 +160,7 @@
 	uint8_t *mad;
 	uint32_t trid;
 	uint8_t umad[sizeof(struct ib_user_mad) + IB_MAD_SIZE];
-	int length = umad_size() + IB_MAD_SIZE;
+	int length = IB_MAD_SIZE;
 
 	memset(umad, 0, sizeof(umad));
 
diff -r -u /tmp/infiniband-diags-1.5.8/libibnetdisc/src/internal.h infiniband-diags-1.5.8/libibnetdisc/src/internal.h
--- /tmp/infiniband-diags-1.5.8/libibnetdisc/src/internal.h	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/libibnetdisc/src/internal.h	Tue Sep 17 13:12:20 2013
@@ -41,12 +41,56 @@
 #include <infiniband/ibnetdisc.h>
 #include <complib/cl_qmap.h>
 
+#if defined(__SVR4) && defined(__sun)
+#include <sys/varargs.h>
+
+static inline void
+ibnd_msg_internal(FILE *fd, const char *format, va_list alist)
+{
+	const char	*filename;
+	char		*filename_p;
+	char		*format_p = format;
+
+	/*
+	 * The filename returned by va_arg() has the full path. Skip "%s"
+	 * from format="%s:%u; " and truncate full pathname of src file to
+	 * start with infiniband-diags.
+	 */
+	filename = va_arg(alist, const char *);
+	format_p += 2;
+	if ((filename_p = strstr(filename, "infiniband-diags-")) != NULL) {
+		(void) fprintf(fd, "%s", filename_p);
+		(void) vfprintf(fd, format_p, alist);
+	} else {
+		(void) fprintf(fd, "%s", filename);
+		(void) vfprintf(fd, format_p, alist);
+	}
+}
+
+static inline void
+ibnd_msg(FILE *fd, const char *format, ...)
+{
+	va_list alist;
+
+	va_start(alist, format);
+	ibnd_msg_internal(fd, format, alist);
+	va_end(alist);
+}
+
 #define	IBND_DEBUG(fmt, ...) \
 	if (ibdebug) { \
+		ibnd_msg(stdout, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
+	}
+#define	IBND_ERROR(fmt, ...) \
+		ibnd_msg(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
+#else
+#define	IBND_DEBUG(fmt, ...) \
+	if (ibdebug) { \
 		printf("%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
 	}
 #define	IBND_ERROR(fmt, ...) \
 		fprintf(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
+#endif
 
 /* HASH table defines */
 #define HASHGUID(guid) ((uint32_t)(((uint32_t)(guid) * 101) ^ ((uint32_t)((guid) >> 32) * 103)))
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibstat.8 infiniband-diags-1.5.8/man/ibstat.8
--- /tmp/infiniband-diags-1.5.8/man/ibstat.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibstat.8	Thu Feb 24 11:26:48 2011
@@ -1,4 +1,4 @@
-.TH IBSTAT 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBSTAT 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibstat \- query basic status of InfiniBand device(s)
@@ -103,7 +103,7 @@
 ibstat mthca0 2   # show status of port 2 of 'mthca0'
 
 .SH SEE ALSO
-.BR ibstatus (8)
+.BR ibstatus (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/vendstat.8 infiniband-diags-1.5.8/man/vendstat.8
--- /tmp/infiniband-diags-1.5.8/man/vendstat.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/vendstat.8	Thu Feb 24 11:26:50 2011
@@ -1,4 +1,4 @@
-.TH VENDSTAT 8 "February 10, 2010" "OpenIB" "OpenIB Diagnostics"
+.TH VENDSTAT 1m "February 10, 2010" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 vendstat \- query InfiniBand vendor specific functions
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckportstate.8 infiniband-diags-1.5.8/man/ibcheckportstate.8
--- /tmp/infiniband-diags-1.5.8/man/ibcheckportstate.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcheckportstate.8	Thu Feb 24 11:26:42 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKPORTSTATE 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKPORTSTATE 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcheckportstate \- validate IB port for LinkUp and not Active state
@@ -35,8 +35,8 @@
 ibcheckportstate 2 3         # check lid 2 port 3
 
 .SH SEE ALSO
-.BR smpquery(8),
-.BR ibaddr(8)
+.BR smpquery(1m),
+.BR ibaddr(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibnodes.8 infiniband-diags-1.5.8/man/ibnodes.8
--- /tmp/infiniband-diags-1.5.8/man/ibnodes.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibnodes.8	Thu Feb 24 11:26:46 2011
@@ -1,4 +1,4 @@
-.TH IBNODES 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBNODES 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibnodes \- show InfiniBand nodes in topology
@@ -23,7 +23,7 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 .SH SEE ALSO
 
-.BR ibnetdiscover(8)
+.BR ibnetdiscover(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibchecknode.8 infiniband-diags-1.5.8/man/ibchecknode.8
--- /tmp/infiniband-diags-1.5.8/man/ibchecknode.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibchecknode.8	Thu Feb 24 11:26:42 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKNODE 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKNODE 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibchecknode \- validate IB node and report errors
@@ -34,8 +34,8 @@
 ibchecknode 2           # check node via lid 2
 
 .SH SEE ALSO
-.BR smpquery(8),
-.BR ibaddr(8)
+.BR smpquery(1m),
+.BR ibaddr(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckport.8 infiniband-diags-1.5.8/man/ibcheckport.8
--- /tmp/infiniband-diags-1.5.8/man/ibcheckport.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcheckport.8	Thu Feb 24 11:26:42 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKPORT 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKPORT 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcheckport \- validate IB port and report errors
@@ -34,8 +34,8 @@
 ibcheckport 2 3         # check lid 2 port 3
 
 .SH SEE ALSO
-.BR smpquery(8),
-.BR ibaddr(8)
+.BR smpquery(1m),
+.BR ibaddr(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckstate.8 infiniband-diags-1.5.8/man/ibcheckstate.8
--- /tmp/infiniband-diags-1.5.8/man/ibcheckstate.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcheckstate.8	Thu Feb 24 11:26:43 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKSTATE 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKSTATE 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcheckstate \- find ports in IB subnet which are link up but not active
@@ -26,9 +26,9 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8),
-.BR ibchecknode(8),
-.BR ibcheckportstate(8)
+.BR ibnetdiscover(1m),
+.BR ibchecknode(1m),
+.BR ibcheckportstate(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/smpquery.8 infiniband-diags-1.5.8/man/smpquery.8
--- /tmp/infiniband-diags-1.5.8/man/smpquery.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/smpquery.8	Thu Feb 24 11:26:50 2011
@@ -1,4 +1,4 @@
-.TH SMPQUERY 8 "March 14, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH SMPQUERY 1m "March 14, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 smpquery \- query InfiniBand subnet management attributes
@@ -34,7 +34,7 @@
 \fB\-\-node\-name\-map\fR <node-name-map>
 Specify a node name map.  The node name map file maps GUIDs to more
 user friendly names.  See
-.B ibnetdiscover(8)
+.B ibnetdiscover(1m)
 for node name map file format.
 
 .SH COMMON OPTIONS
@@ -108,7 +108,7 @@
 smpquery -c nodeinfo 6 0,12  # nodeinfo by combined route
 
 .SH SEE ALSO
-.BR smpdump (8)
+.BR smpdump (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckerrors.8 infiniband-diags-1.5.8/man/ibcheckerrors.8
--- /tmp/infiniband-diags-1.5.8/man/ibcheckerrors.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcheckerrors.8	Thu Feb 24 11:26:41 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKERRORS 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKERRORS 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcheckerrors \- validate IB subnet and report errors
@@ -30,10 +30,10 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8),
-.BR ibchecknode(8),
-.BR ibcheckport(8),
-.BR ibcheckerrs(8)
+.BR ibnetdiscover(1m),
+.BR ibchecknode(1m),
+.BR ibcheckport(1m),
+.BR ibcheckerrs(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibprintca.8 infiniband-diags-1.5.8/man/ibprintca.8
--- /tmp/infiniband-diags-1.5.8/man/ibprintca.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibprintca.8	Thu Feb 24 11:26:47 2011
@@ -1,4 +1,4 @@
-.TH IBPRINTCA 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBPRINTCA 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibprintca.pl \- print either the ca specified or the list of cas from the ibnetdiscover output
diff -r -u /tmp/infiniband-diags-1.5.8/man/sminfo.8 infiniband-diags-1.5.8/man/sminfo.8
--- /tmp/infiniband-diags-1.5.8/man/sminfo.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/sminfo.8	Thu Feb 24 11:26:50 2011
@@ -1,4 +1,4 @@
-.TH SMINFO 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH SMINFO 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 sminfo \- query InfiniBand SMInfo attribute
@@ -99,7 +99,7 @@
 sminfo  -G 0x8f1040023  # same but using guid address
 
 .SH SEE ALSO
-.BR smpdump (8)
+.BR smpdump (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibdiscover.8 infiniband-diags-1.5.8/man/ibdiscover.8
--- /tmp/infiniband-diags-1.5.8/man/ibdiscover.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibdiscover.8	Thu Feb 24 11:26:44 2011
@@ -1,4 +1,4 @@
-.TH IBDISCOVER.PL 8 "September 21, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBDISCOVER.PL 1m "September 21, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibdiscover.pl \- annotate and compare InfiniBand topology
@@ -42,7 +42,7 @@
 ibnetdiscover | ibdiscover.pl
 
 .SH SEE ALSO
-.BR ibnetdiscover(8)
+.BR ibnetdiscover(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/iblinkinfo.8 infiniband-diags-1.5.8/man/iblinkinfo.8
--- /tmp/infiniband-diags-1.5.8/man/iblinkinfo.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/iblinkinfo.8	Fri Feb 25 03:09:26 2011
@@ -1,4 +1,4 @@
-.TH IBLINKINFO 8 "Jan 24, 2008" "OpenIB" "OpenIB Diagnostics"
+.TH IBLINKINFO 1m "Jan 24, 2008" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 iblinkinfo \- report link info for all links in the fabric
diff -r -u /tmp/infiniband-diags-1.5.8/man/dump_mfts.8 infiniband-diags-1.5.8/man/dump_mfts.8
--- /tmp/infiniband-diags-1.5.8/man/dump_mfts.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/dump_mfts.8	Thu Feb 24 11:26:41 2011
@@ -1,4 +1,4 @@
-.TH DUMP_MFTS.SH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH DUMP_MFTS.SH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 dump_lfts.sh \- dump InfiniBand multicast forwarding tables
@@ -34,10 +34,10 @@
 
 
 .SH SEE ALSO
-.BR dump_lfts(8),
-.BR ibroute(8),
-.BR ibswitches(8),
-.BR opensm(8)
+.BR dump_lfts(1m),
+.BR ibroute(1m),
+.BR ibswitches(1m),
+.BR opensm(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibclearerrors.8 infiniband-diags-1.5.8/man/ibclearerrors.8
--- /tmp/infiniband-diags-1.5.8/man/ibclearerrors.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibclearerrors.8	Thu Feb 24 11:26:44 2011
@@ -1,4 +1,4 @@
-.TH IBCLEARERRORS 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCLEARERRORS 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibclearerrors \- clear error counters in IB subnet
@@ -25,8 +25,8 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8),
-.BR perfquery(8)
+.BR ibnetdiscover(1m),
+.BR perfquery(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibhosts.8 infiniband-diags-1.5.8/man/ibhosts.8
--- /tmp/infiniband-diags-1.5.8/man/ibhosts.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibhosts.8	Thu Feb 24 11:26:45 2011
@@ -1,4 +1,4 @@
-.TH IBHOSTS 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBHOSTS 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibhosts \- show InfiniBand host nodes in topology
@@ -23,7 +23,7 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8)
+.BR ibnetdiscover(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckportwidth.8 infiniband-diags-1.5.8/man/ibcheckportwidth.8
--- /tmp/infiniband-diags-1.5.8/man/ibcheckportwidth.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcheckportwidth.8	Thu Feb 24 11:26:43 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKPORTWIDTH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKPORTWIDTH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcheckportwidth \- validate IB port for 1x link width
@@ -34,8 +34,8 @@
 ibcheckportwidth 2 3         # check lid 2 port 3
 
 .SH SEE ALSO
-.BR smpquery(8),
-.BR ibaddr(8)
+.BR smpquery(1m),
+.BR ibaddr(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/check_lft_balance.8 infiniband-diags-1.5.8/man/check_lft_balance.8
--- /tmp/infiniband-diags-1.5.8/man/check_lft_balance.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/check_lft_balance.8	Thu Feb 24 11:26:40 2011
@@ -1,4 +1,4 @@
-.TH CHECK_LFT_BALANCE.SH 8 "March 1, 2008" "OpenIB" "OpenIB Diagnostics"
+.TH CHECK_LFT_BALANCE.SH 1m "March 1, 2008" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 check_lft_balance.sh \- check InfiniBand unicast forwarding tables balance
@@ -12,9 +12,9 @@
 .PP
 check_lft_balance.sh is a script which checks for balancing in Infiniband
 unicast forwarding tables.  It analyzes the output of
-.BR dump_lfts(8)
+.BR dump_lfts(1m)
 and
-.BR iblinkinfo(8).
+.BR iblinkinfo(1m).
 
 .SH OPTIONS
 
@@ -33,8 +33,8 @@
 verbose output
 
 .SH SEE ALSO
-.BR dump_lfts(8),
-.BR iblinkinfo(8)
+.BR dump_lfts(1m),
+.BR iblinkinfo(1m)
 
 .SH AUTHORS
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibidsverify.8 infiniband-diags-1.5.8/man/ibidsverify.8
--- /tmp/infiniband-diags-1.5.8/man/ibidsverify.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibidsverify.8	Thu Feb 24 11:26:45 2011
@@ -1,4 +1,4 @@
-.TH IBIDSVERIFY 8 "June 1, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBIDSVERIFY 1m "June 1, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibidsverify.pl \- validate IB identifiers in subnet and report errors
@@ -28,7 +28,7 @@
 fabric has changed.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8)
+.BR ibnetdiscover(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibqueryerrors.8 infiniband-diags-1.5.8/man/ibqueryerrors.8
--- /tmp/infiniband-diags-1.5.8/man/ibqueryerrors.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibqueryerrors.8	Thu Feb 24 11:26:47 2011
@@ -1,4 +1,4 @@
-.TH IBQUERYERRORS 8 "Dec 31, 2009" "OpenIB" "OpenIB Diagnostics"
+.TH IBQUERYERRORS 1m "Dec 31, 2009" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibqueryerrors \- query and report non-zero IB port counters
diff -r -u /tmp/infiniband-diags-1.5.8/man/dump_lfts.8 infiniband-diags-1.5.8/man/dump_lfts.8
--- /tmp/infiniband-diags-1.5.8/man/dump_lfts.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/dump_lfts.8	Thu Feb 24 11:26:40 2011
@@ -1,4 +1,4 @@
-.TH DUMP_LFTS.SH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH DUMP_LFTS.SH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 dump_lfts.sh \- dump InfiniBand unicast forwarding tables
@@ -37,10 +37,10 @@
 override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR dump_mfts(8),
-.BR ibroute(8),
-.BR ibswitches(8),
-.BR opensm(8)
+.BR dump_mfts(1m),
+.BR ibroute(1m),
+.BR ibswitches(1m),
+.BR opensm(1m)
 
 .SH AUTHORS
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibnetdiscover.8 infiniband-diags-1.5.8/man/ibnetdiscover.8
--- /tmp/infiniband-diags-1.5.8/man/ibnetdiscover.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibnetdiscover.8	Thu Feb 24 11:26:46 2011
@@ -1,4 +1,4 @@
-.TH IBNETDISCOVER 8 "May 13, 2009" "OpenIB" "OpenIB Diagnostics"
+.TH IBNETDISCOVER 1m "May 13, 2009" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibnetdiscover \- discover InfiniBand topology
diff -r -u /tmp/infiniband-diags-1.5.8/man/saquery.8 infiniband-diags-1.5.8/man/saquery.8
--- /tmp/infiniband-diags-1.5.8/man/saquery.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/saquery.8	Thu Feb 24 11:26:50 2011
@@ -1,4 +1,4 @@
-.TH SAQUERY 8 "October 19, 2008" "OpenIB" "OpenIB Diagnostics"
+.TH SAQUERY 1m "October 19, 2008" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 saquery \- query InfiniBand subnet administration attributes
@@ -99,7 +99,7 @@
 \fB\-\-node\-name\-map\fR <node-name-map>
 Specify a node name map.  The node name map file maps GUIDs to more
 user friendly names.  See
-.B ibnetdiscover(8)
+.B ibnetdiscover(1m)
 for node name map file format.  Only used with the \fB\-O\fR and \fB\-U\fR
 options.
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibtracert.8 infiniband-diags-1.5.8/man/ibtracert.8
--- /tmp/infiniband-diags-1.5.8/man/ibtracert.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibtracert.8	Fri Feb 25 03:09:26 2011
@@ -1,4 +1,4 @@
-.TH IBTRACERT 8 "September 14, 2010" "OpenIB" "OpenIB Diagnostics"
+.TH IBTRACERT 1m "September 14, 2010" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibtracert\- trace InfiniBand path
@@ -31,7 +31,7 @@
 \fB\-\-node\-name\-map\fR <node-name-map>
 Specify a node name map.  The node name map file maps GUIDs to more
 user friendly names.  See
-.B ibnetdiscover(8)
+.B ibnetdiscover(1m)
 for node name map file format.
 
 .SH COMMON OPTIONS
@@ -97,7 +97,7 @@
 ibtracert -m 0xc000 4 16    # show multicast path of mlid 0xc000 between lids 4 and 16
 
 .SH SEE ALSO
-.BR ibroute (8)
+.BR ibroute (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibaddr.8 infiniband-diags-1.5.8/man/ibaddr.8
--- /tmp/infiniband-diags-1.5.8/man/ibaddr.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibaddr.8	Thu Feb 24 11:26:41 2011
@@ -1,4 +1,4 @@
-.TH IBADDR 8 "June 18, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBADDR 1m "June 18, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibaddr \- query InfiniBand address(es)
@@ -102,8 +102,8 @@
 ibaddr -g 32            # show gid address only
 
 .SH SEE ALSO
-.BR ibroute (8),
-.BR ibtracert (8)
+.BR ibroute (1m),
+.BR ibtracert (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/perfquery.8 infiniband-diags-1.5.8/man/perfquery.8
--- /tmp/infiniband-diags-1.5.8/man/perfquery.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/perfquery.8	Thu Feb 24 11:26:49 2011
@@ -1,4 +1,4 @@
-.TH PERFQUERY 8 "Jun 16, 2010" "OpenIB" "OpenIB Diagnostics"
+.TH PERFQUERY 1m "Jun 16, 2010" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 perfquery \- query InfiniBand port counters
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibroute.8 infiniband-diags-1.5.8/man/ibroute.8
--- /tmp/infiniband-diags-1.5.8/man/ibroute.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibroute.8	Thu Feb 24 11:26:47 2011
@@ -1,4 +1,4 @@
-.TH IBROUTE 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBROUTE 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibroute \- query InfiniBand switch forwarding tables
@@ -114,7 +114,7 @@
 ibroute -M -n 4 # simple dump format
 
 .SH SEE ALSO
-.BR ibtracert (8)
+.BR ibtracert (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibsysstat.8 infiniband-diags-1.5.8/man/ibsysstat.8
--- /tmp/infiniband-diags-1.5.8/man/ibsysstat.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibsysstat.8	Thu Feb 24 11:26:49 2011
@@ -1,4 +1,4 @@
-.TH IBSYSSTAT 8 "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBSYSSTAT 1m "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibsysstat \- system status on an InfiniBand address
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckwidth.8 infiniband-diags-1.5.8/man/ibcheckwidth.8
--- /tmp/infiniband-diags-1.5.8/man/ibcheckwidth.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcheckwidth.8	Thu Feb 24 11:26:43 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKWIDTH 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKWIDTH 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcheckwidth \- find 1x links in IB subnet
@@ -26,9 +26,9 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8),
-.BR ibchecknode(8),
-.BR ibcheckportwidth(8)
+.BR ibnetdiscover(1m),
+.BR ibchecknode(1m),
+.BR ibcheckportwidth(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcacheedit.8 infiniband-diags-1.5.8/man/ibcacheedit.8
--- /tmp/infiniband-diags-1.5.8/man/ibcacheedit.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcacheedit.8	Thu Feb 24 11:26:41 2011
@@ -1,4 +1,4 @@
-.TH IBCACHEEDIT 8 "Apr 15, 2010" "OpenIB" "OpenIB Diagnostics"
+.TH IBCACHEEDIT 1m "Apr 15, 2010" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcacheedit \- edit an ibnetdiscover cache
@@ -13,7 +13,7 @@
 .PP
 ibcacheedit allows users to edit an ibnetdiscover cache created through the
 \fB\-\-cache\fR option in
-.B ibnetdiscover(8).
+.B ibnetdiscover(1m).
 
 .SH OPTIONS
 
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibswitches.8 infiniband-diags-1.5.8/man/ibswitches.8
--- /tmp/infiniband-diags-1.5.8/man/ibswitches.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibswitches.8	Thu Feb 24 11:26:48 2011
@@ -1,4 +1,4 @@
-.TH IBSWITCHES 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBSWITCHES 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibswitches\- show InfiniBand switch nodes in topology
@@ -23,7 +23,7 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8)
+.BR ibnetdiscover(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibfindnodesusing.8 infiniband-diags-1.5.8/man/ibfindnodesusing.8
--- /tmp/infiniband-diags-1.5.8/man/ibfindnodesusing.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibfindnodesusing.8	Thu Feb 24 11:26:45 2011
@@ -1,4 +1,4 @@
-.TH IBFINDNODESUSING 8 "May 22, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBFINDNODESUSING 1m "May 22, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibfindnodesusing.pl \- find a list of end nodes which are routed through
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibprintrt.8 infiniband-diags-1.5.8/man/ibprintrt.8
--- /tmp/infiniband-diags-1.5.8/man/ibprintrt.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibprintrt.8	Thu Feb 24 11:26:47 2011
@@ -1,4 +1,4 @@
-.TH IBPRINTRT 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBPRINTRT 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibprintrt.pl \- print either only the router specified or a list of routers
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibswportwatch.8 infiniband-diags-1.5.8/man/ibswportwatch.8
--- /tmp/infiniband-diags-1.5.8/man/ibswportwatch.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibswportwatch.8	Thu Feb 24 11:26:49 2011
@@ -1,4 +1,4 @@
-.TH IBSWPORTWATCH 8 "September 27, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBSWPORTWATCH 1m "September 27, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibswportwatch.pl \- poll the counters on the specified switch/port and
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibprintswitch.8 infiniband-diags-1.5.8/man/ibprintswitch.8
--- /tmp/infiniband-diags-1.5.8/man/ibprintswitch.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibprintswitch.8	Thu Feb 24 11:26:47 2011
@@ -1,4 +1,4 @@
-.TH IBPRINTSWITCH 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBPRINTSWITCH 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibprintswitch.pl \- print either the switch specified or a list of switches
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibchecknet.8 infiniband-diags-1.5.8/man/ibchecknet.8
--- /tmp/infiniband-diags-1.5.8/man/ibchecknet.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibchecknet.8	Thu Feb 24 11:26:42 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKNET 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKNET 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibchecknet \- validate IB subnet and report errors
@@ -25,10 +25,10 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8),
-.BR ibchecknode(8),
-.BR ibcheckport(8),
-.BR ibcheckerrs(8)
+.BR ibnetdiscover(1m),
+.BR ibchecknode(1m),
+.BR ibcheckport(1m),
+.BR ibcheckerrs(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibclearcounters.8 infiniband-diags-1.5.8/man/ibclearcounters.8
--- /tmp/infiniband-diags-1.5.8/man/ibclearcounters.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibclearcounters.8	Thu Feb 24 11:26:44 2011
@@ -1,4 +1,4 @@
-.TH IBCLEARCOUNTERS 8 "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCLEARCOUNTERS 1m "May 21, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibclearcounters \- clear port counters in IB subnet
@@ -21,8 +21,8 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8),
-.BR perfquery(8)
+.BR ibnetdiscover(1m),
+.BR perfquery(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibdatacounters.8 infiniband-diags-1.5.8/man/ibdatacounters.8
--- /tmp/infiniband-diags-1.5.8/man/ibdatacounters.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibdatacounters.8	Thu Feb 24 11:26:44 2011
@@ -1,4 +1,4 @@
-.TH IBDATACOUNTERS 8 "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBDATACOUNTERS 1m "May 31, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibdatacounters \- query IB subnet for data counters
@@ -30,8 +30,8 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8),
-.BR ibdatacounts(8)
+.BR ibnetdiscover(1m),
+.BR ibdatacounts(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibping.8 infiniband-diags-1.5.8/man/ibping.8
--- /tmp/infiniband-diags-1.5.8/man/ibping.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibping.8	Thu Feb 24 11:26:46 2011
@@ -1,4 +1,4 @@
-.TH IBPING 8 "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBPING 1m "August 11, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibping \- ping an InfiniBand address
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibcheckerrs.8 infiniband-diags-1.5.8/man/ibcheckerrs.8
--- /tmp/infiniband-diags-1.5.8/man/ibcheckerrs.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibcheckerrs.8	Thu Feb 24 11:26:42 2011
@@ -1,4 +1,4 @@
-.TH IBCHECKERRS 8 "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBCHECKERRS 1m "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibcheckerrs \- validate IB port (or node) and report errors in counters above threshold
@@ -50,8 +50,8 @@
 ibcheckerrs -T xxx 2    # check node using xxx threshold file
 
 .SH SEE ALSO
-.BR perfquery(8),
-.BR ibaddr(8)
+.BR perfquery(1m),
+.BR ibaddr(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/smpdump.8 infiniband-diags-1.5.8/man/smpdump.8
--- /tmp/infiniband-diags-1.5.8/man/smpdump.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/smpdump.8	Thu Feb 24 11:26:50 2011
@@ -1,4 +1,4 @@
-.TH SMPDUMP 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH SMPDUMP 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 smpdump \- dump InfiniBand subnet management attributes
@@ -91,7 +91,7 @@
 smpdump 0xa0 0x11       # NODE INFO, lid 0xa0
 
 .SH SEE ALSO
-.BR smpquery (8)
+.BR smpquery (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibrouters.8 infiniband-diags-1.5.8/man/ibrouters.8
--- /tmp/infiniband-diags-1.5.8/man/ibrouters.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibrouters.8	Thu Feb 24 11:26:48 2011
@@ -1,4 +1,4 @@
-.TH IBROUTERS 8 "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBROUTERS 1m "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibrouters \- show InfiniBand router nodes in topology
@@ -23,7 +23,7 @@
 \-t <timeout_ms> override the default timeout for the solicited mads.
 
 .SH SEE ALSO
-.BR ibnetdiscover(8)
+.BR ibnetdiscover(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibportstate.8 infiniband-diags-1.5.8/man/ibportstate.8
--- /tmp/infiniband-diags-1.5.8/man/ibportstate.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibportstate.8	Thu Feb 24 11:26:46 2011
@@ -1,4 +1,4 @@
-.TH IBPORTSTATE 8 "Jan 13, 2010" "OpenIB" "OpenIB Diagnostics"
+.TH IBPORTSTATE 1m "Jan 13, 2010" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibportstate \- handle port (physical) state and link speed of an InfiniBand port
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibstatus.8 infiniband-diags-1.5.8/man/ibstatus.8
--- /tmp/infiniband-diags-1.5.8/man/ibstatus.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibstatus.8	Thu Feb 24 11:26:48 2011
@@ -1,4 +1,4 @@
-.TH IBSTATUS 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBSTATUS 1m "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibstatus \- query basic status of InfiniBand device(s)
@@ -33,7 +33,7 @@
 ibstatus mthca1:1 mthca0:2      # show status of specified ports
 
 .SH SEE ALSO
-.BR ibstat (8)
+.BR ibstat (1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/man/ibdatacounts.8 infiniband-diags-1.5.8/man/ibdatacounts.8
--- /tmp/infiniband-diags-1.5.8/man/ibdatacounts.8	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/man/ibdatacounts.8	Thu Feb 24 11:26:44 2011
@@ -1,4 +1,4 @@
-.TH IBDATACOUNTS 8 "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
+.TH IBDATACOUNTS 1m "May 30, 2007" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibdatacounts \- get IB port data counters
@@ -39,8 +39,8 @@
 ibdatacounts 2   4       # show data counters for lid 2 port 4
 
 .SH SEE ALSO
-.BR perfquery(8),
-.BR ibaddr(8)
+.BR perfquery(1m),
+.BR ibaddr(1m)
 
 .SH AUTHOR
 .TP
diff -r -u /tmp/infiniband-diags-1.5.8/configure infiniband-diags-1.5.8/configure
--- /tmp/infiniband-diags-1.5.8/configure	Wed Feb 16 02:28:21 2011
+++ infiniband-diags-1.5.8/configure	Fri Feb 25 03:09:23 2011
@@ -8689,6 +8689,7 @@
 	;;
       esac
       link_all_deplibs=yes
+      hardcode_libdir_flag_spec=
       ;;
 
     sunos4*)
diff -r -u /tmp/infiniband-diags-1.5.8/infiniband-diags.spec.in infiniband-diags-1.5.8/infiniband-diags.spec.in
--- /tmp/infiniband-diags-1.5.8/infiniband-diags.spec.in	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/infiniband-diags.spec.in	Thu Feb 24 11:26:32 2011
@@ -52,7 +52,7 @@
 %{_includedir}/infiniband/*.h
 %define _perldir %(perl -e 'use Config; $T=$Config{installsitearch}; $T=~/(.*)\\/site_perl.*/; print $1;')
 %{_perldir}/*
-%{_mandir}/man8/*
+%{_mandir}/man1m/*
 %{_mandir}/man3/*
 %doc README COPYING ChangeLog
 
diff -r -u /tmp/infiniband-diags-1.5.8/src/ibsysstat.c infiniband-diags-1.5.8/src/ibsysstat.c
--- /tmp/infiniband-diags-1.5.8/src/ibsysstat.c	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/src/ibsysstat.c	Wed Oct  5 09:27:26 2011
@@ -40,6 +40,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <getopt.h>
+#include <signal.h>
 
 #include <infiniband/umad.h>
 #include <infiniband/mad.h>
@@ -62,7 +63,7 @@
 } cpu_info;
 
 static cpu_info cpus[MAX_CPUS];
-static int host_ncpu;
+static int host_ncpu = 0;
 
 static int server_respond(void *umad, int size)
 {
@@ -142,7 +143,8 @@
 		break;
 	case IB_CPUINFO_ATTR:
 		s[0] = '\0';
-		for (i = 0; i < host_ncpu && sz > 0; i++) {
+		for (i = 0; i < host_ncpu && sz > 0 && ret < 
+		    IB_VENDOR_RANGE2_DATA_SIZE; i++) {
 			n = snprintf(s, sz, "cpu %d: model %s MHZ %s\n",
 				     i, cpus[i].model, cpus[i].mhz);
 			if (n >= sz) {
@@ -154,6 +156,8 @@
 			s += n;
 			ret += n;
 		}
+		if (i < host_ncpu)
+			IBWARN("cpuinfo truncated");
 		ret++;
 		break;
 	default:
@@ -162,6 +166,20 @@
 	return ret;
 }
 
+void cleanup(int sig)
+{
+	int	i;
+	for (i = 0; i < host_ncpu ; i++) {
+		if (cpus[i].model)
+			free(cpus[i].model);
+		if (cpus[i].mhz)
+			free(cpus[i].mhz);
+	}
+	mad_rpc_close_port(srcport);
+	(void) signal(SIGINT, SIG_DFL);
+	exit (0);
+}
+
 static uint8_t buf[2048];
 
 static char *ibsystat_serv(void)
@@ -171,6 +189,7 @@
 	int attr, mod, size;
 
 	DEBUG("starting to serve...");
+	(void) signal(SIGINT, cleanup);
 
 	while ((umad = mad_receive_via(buf, -1, srcport))) {
 		if (umad_status(buf)) {
@@ -261,7 +280,25 @@
 	char line[1024] = { 0 }, *s, *e;
 	FILE *f;
 	int ncpu = 0;
+#if defined(__SVR4) && defined(__sun)
+	int		i;
+	char		mhz[8];
+	sol_cpu_info_t	*cpu_info;
 
+	ncpu = sol_get_cpu_info(&cpu_info);
+	ncpu = ncpu < MAX_CPUS ? ncpu : MAX_CPUS;
+	if (ncpu <= 0) {
+		IBWARN("couldn't get cpu info");
+		return 0;
+	}
+
+	for (i = 0; i < ncpu; i++) {
+		cpus[i].model = strdup(cpu_info[i].cpu_name);
+		snprintf(mhz, 8, "%d", cpu_info[i].cpu_mhz);
+		cpus[i].mhz = strdup(mhz);
+	}
+	free(cpu_info);
+#else
 	if (!(f = fopen("/proc/cpuinfo", "r"))) {
 		IBWARN("couldn't open /proc/cpuinfo");
 		return 0;
@@ -287,6 +324,7 @@
 	}
 
 	fclose(f);
+#endif
 
 	DEBUG("ncpu %d", ncpu);
 
@@ -314,7 +352,7 @@
 {
 	int mgmt_classes[3] =
 	    { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS };
-	int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS;
+	int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS, i;
 	ib_portid_t portid = { 0 };
 	int attr = IB_PING_ATTR;
 	char *err;
@@ -342,6 +380,8 @@
 	if (!srcport)
 		IBERROR("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
 
+	bzero((void *)cpus, MAX_CPUS * sizeof (cpu_info));
+
 	if (server) {
 		if (mad_register_server_via(sysstat_class, 1, 0, oui, srcport) <
 		    0)
@@ -366,5 +406,6 @@
 		IBERROR("ibsystat to %s: %s", portid2str(&portid), err);
 
 	mad_rpc_close_port(srcport);
+
 	exit(0);
 }
diff -r -u /tmp/infiniband-diags-1.5.8/src/ibnetdiscover.c infiniband-diags-1.5.8/src/ibnetdiscover.c
--- /tmp/infiniband-diags-1.5.8/src/ibnetdiscover.c	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/src/ibnetdiscover.c	Thu Feb 24 11:27:00 2011
@@ -523,7 +523,7 @@
 			}
 
 			fprintf(f, "\n# Spine Nodes");
-			for (n = 1; n <= SPINES_MAX_NUM; n++) {
+			for (n = 0; n < SPINES_MAX_NUM; n++) {
 				if (ch->spinenode[n]) {
 					out_switch(ch->spinenode[n], group,
 						   chname, NULL, NULL);
@@ -540,7 +540,7 @@
 				}
 			}
 			fprintf(f, "\n# Line Nodes");
-			for (n = 1; n <= LINES_MAX_NUM; n++) {
+			for (n = 0; n < LINES_MAX_NUM; n++) {
 				if (ch->linenode[n]) {
 					out_switch(ch->linenode[n], group,
 						   chname, NULL, NULL);
diff -r -u /tmp/infiniband-diags-1.5.8/src/saquery.c infiniband-diags-1.5.8/src/saquery.c
--- /tmp/infiniband-diags-1.5.8/src/saquery.c	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/src/saquery.c	Thu Jun 23 10:36:40 2011
@@ -104,7 +104,6 @@
 /**
  * Declare some globals because I don't want this to be too complex.
  */
-#define MAX_PORTS (8)
 #define DEFAULT_SA_TIMEOUT_MS (1000)
 static struct query_res result;
 
@@ -1757,7 +1756,7 @@
 			requested_lid = (uint16_t) strtoul(argv[0], NULL, 0);
 			requested_lid_flag++;
 		} else if (node_print_desc == NAME_OF_GUID) {
-			requested_guid = strtoul(argv[0], NULL, 0);
+			requested_guid = strtoull(argv[0], NULL, 0);
 			requested_guid_flag++;
 		} else
 			requested_name = argv[0];
diff -r -u /tmp/infiniband-diags-1.5.8/src/ibportstate.c infiniband-diags-1.5.8/src/ibportstate.c
--- /tmp/infiniband-diags-1.5.8/src/ibportstate.c	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/src/ibportstate.c	Thu Feb 24 11:27:00 2011
@@ -252,6 +252,7 @@
 	int portnum = 0;
 	ib_portid_t selfportid = { 0 };
 	int selfport = 0;
+	int switch_lid = 0;
 	int changed = 0;
 	int i;
 	long val;
@@ -351,6 +352,11 @@
 		port_op = QUERY;
 
 	is_switch = get_node_info(&portid, data);
+	if (!is_switch && (port_op == RESET || port_op == DISABLE ||
+	    port_op == ENABLE)) {
+		mad_rpc_close_port(srcport);
+		exit(-1);
+	}
 
 	if (port_op != QUERY || changed)
 		printf("Initial %s PortInfo:\n", is_switch ? "Switch" : "CA");
@@ -431,6 +437,12 @@
 			mad_decode_field(data, IB_PORT_LINK_SPEED_ENABLED_F,
 					 &lse);
 
+			/* Get Switch LID from the default switch port */
+			if (!smp_query_via(data, &portid, IB_ATTR_PORT_INFO, 0, 0, srcport))
+				IBERROR("could not get port LID");
+
+			switch_lid = mad_get_field(data, 0, IB_PORT_LID_F);
+
 			/* Setup portid for peer port */
 			memcpy(&peerportid, &portid, sizeof(peerportid));
 			peerportid.drpath.cnt = 1;
@@ -440,6 +452,7 @@
 			if (ib_resolve_self_via(&selfportid,
 						&selfport, 0, srcport) < 0)
 				IBERROR("could not resolve self");
+			peerportid.lid = switch_lid;
 			peerportid.drpath.drslid = (uint16_t) selfportid.lid;
 			peerportid.drpath.drdlid = 0xffff;
 
diff -r -u /tmp/infiniband-diags-1.5.8/src/ibstat.c infiniband-diags-1.5.8/src/ibstat.c
--- /tmp/infiniband-diags-1.5.8/src/ibstat.c	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/src/ibstat.c	Fri Feb 25 03:09:28 2011
@@ -46,6 +46,7 @@
 
 #include <infiniband/umad.h>
 #include <infiniband/mad.h>
+#include <infiniband/verbs.h>
 
 #include <ibdiag_common.h>
 
@@ -78,7 +79,7 @@
 }
 
 static char *port_state_str[] = {
-	"???",
+	"Unknown",
 	"Down",
 	"Initializing",
 	"Armed",
@@ -112,10 +113,10 @@
 	printf("%sPort %d:\n", hdrpre, port->portnum);
 	printf("%sState: %s\n", pre,
 	       (unsigned)port->state <=
-	       4 ? port_state_str[port->state] : "???");
+	       4 ? port_state_str[port->state] : "Unknown");
 	printf("%sPhysical state: %s\n", pre,
 	       (unsigned)port->phys_state <=
-	       7 ? port_phy_state_str[port->phys_state] : "???");
+	       7 ? port_phy_state_str[port->phys_state] : "Unknown");
 	printf("%sRate: %d\n", pre, port->rate);
 	printf("%sBase lid: %d\n", pre, port->base_lid);
 	printf("%sLMC: %d\n", pre, port->lmc);
@@ -167,13 +168,13 @@
 
 static int ports_list(char names[][UMAD_CA_NAME_LEN], int n)
 {
-	uint64_t guids[64];
+	uint64_t guids[MAX_PORTS];
 	int found, ports, i;
 
-	for (i = 0, found = 0; i < n && found < 64; i++) {
+	for (i = 0, found = 0; i < n && found < MAX_PORTS; i++) {
 		if ((ports =
 		     umad_get_ca_portguids(names[i], guids + found,
-					   64 - found)) < 0)
+					   MAX_PORTS - found)) < 0)
 			return -1;
 		found += ports;
 	}
@@ -245,7 +246,7 @@
 		if (i >= n)
 			IBPANIC("'%s' IB device can't be found", argv[0]);
 
-		strncpy(names[i], argv[0], sizeof names[i]);
+		strncpy(names[0], argv[0], sizeof names[i]);
 		n = 1;
 	}
 
diff -r -u /tmp/infiniband-diags-1.5.8/src/ibdiag_common.c infiniband-diags-1.5.8/src/ibdiag_common.c
--- /tmp/infiniband-diags-1.5.8/src/ibdiag_common.c	Wed Feb 16 02:13:21 2011
+++ infiniband-diags-1.5.8/src/ibdiag_common.c	Tue May  3 13:50:05 2011
@@ -322,15 +322,17 @@
 	char buf[512];
 	va_list va;
 	int n;
+	int bufsz;
 
 	va_start(va, msg);
-	n = vsprintf(buf, msg, va);
+	bufsz = strlen(msg) < sizeof (buf) ? strlen(msg) : sizeof (buf);
+	n = vsnprintf(buf, bufsz, msg, va);
 	va_end(va);
 	buf[n] = 0;
 
 	if (ibdebug)
 		printf("%s: iberror: [pid %d] %s: failed: %s\n",
-		       prog_name ? prog_name : "", getpid(), fn, buf);
+		       prog_name ? prog_name : "", (int)getpid(), fn, buf);
 	else
 		printf("%s: iberror: failed: %s\n",
 		       prog_name ? prog_name : "", buf);
