svn commit: r211198 - in projects/ofed/head/contrib/ofed/management:
infiniband-diags/src opensm/complib opensm/include/complib
Jeff Roberson
jeff at FreeBSD.org
Wed Aug 11 23:56:37 UTC 2010
Author: jeff
Date: Wed Aug 11 23:56:37 2010
New Revision: 211198
URL: http://svn.freebsd.org/changeset/base/211198
Log:
- Use strdup() rather than strdupa(). Leaking one copy of argv[0] is not
a problem.
- Define bswap_16 and bswap_32 via machine/byteorder.h
- Define the wordsize in a somewhat gross way. It's used in if defines so
it can be based on sizeof().
Sponsored by: Isilon Systems, iX Systems, and Panasas.
Modified:
projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c
projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c
projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c
projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h
projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h
projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h
Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c
==============================================================================
--- projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c Wed Aug 11 23:22:53 2010 (r211197)
+++ projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c Wed Aug 11 23:56:37 2010 (r211198)
@@ -295,7 +295,7 @@ main(int argc, char *argv[])
usage();
if (mgmt_class == CLASS_SUBN_DIRECTED_ROUTE &&
- str2DRPath(strdupa(argv[0]), &path) < 0)
+ str2DRPath(strdup(argv[0]), &path) < 0)
IBPANIC("bad path str '%s'", argv[0]);
if (mgmt_class == CLASS_SUBN_LID_ROUTE)
Modified: projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c
==============================================================================
--- projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c Wed Aug 11 23:22:53 2010 (r211197)
+++ projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c Wed Aug 11 23:56:37 2010 (r211198)
@@ -42,7 +42,9 @@
#include <sys/stat.h>
#include <unistd.h>
#include <ctype.h>
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
#include <complib/cl_nodenamemap.h>
Modified: projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c
==============================================================================
--- projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c Wed Aug 11 23:22:53 2010 (r211197)
+++ projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c Wed Aug 11 23:56:37 2010 (r211198)
@@ -39,7 +39,6 @@
#include <stdio.h>
#include <unistd.h>
-#include <sys/sysinfo.h>
#include <complib/cl_thread.h>
/*
@@ -122,7 +121,7 @@ int cl_proc_count(void)
{
uint32_t ret;
- ret = get_nprocs();
+ ret = sysconf(_SC_NPROCESSORS_ONLN);
if (!ret)
return 1; /* Workaround for PPC where get_nprocs() returns 0 */
Modified: projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h
==============================================================================
--- projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h Wed Aug 11 23:22:53 2010 (r211197)
+++ projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h Wed Aug 11 23:56:37 2010 (r211198)
@@ -86,6 +86,11 @@ BEGIN_C_DECLS
* ntoh32, hton32
* ntoh64, hton64
*/
+#include <machine/endian.h>
+#define __BYTE_ORDER _BYTE_ORDER
+#define bswap_16 __bswap16
+#define bswap_32 __bswap32
+
#ifndef __BYTE_ORDER
#error "__BYTE_ORDER macro undefined. Missing in endian.h?"
#endif
Modified: projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h
==============================================================================
--- projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h Wed Aug 11 23:22:53 2010 (r211197)
+++ projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h Wed Aug 11 23:56:37 2010 (r211198)
@@ -42,7 +42,6 @@
#define _CL_DEBUG_OSD_H_
#include <complib/cl_types.h>
-#include <bits/wordsize.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
Modified: projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h
==============================================================================
--- projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h Wed Aug 11 23:22:53 2010 (r211197)
+++ projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h Wed Aug 11 23:56:37 2010 (r211198)
@@ -60,6 +60,14 @@ typedef uint16_t net16_t;
typedef uint32_t net32_t;
typedef uint64_t net64_t;
+#ifndef __WORDSIZE
+#ifdef __LP64__
+#define __WORDSIZE 64
+#else
+#define __WORDSIZE 32
+#endif
+#endif
+
/* explicit cast of void* to uint32_t */
#ifndef ASSERT_VOIDP2UINTN
#if __WORDSIZE == 64
More information about the svn-src-projects
mailing list