Hi Andrew,

Thanks for the catch.  I wrote the attached patch, to try and load
headers (and subsequently MAXHOSTNAMELEN) more correctly and
consistently globally.  I consider that the more core problem (e.g. in
some places I didn't even try and load limits.h for Linux).  Can you
give it a shot and LMK if it works for you.

> Also it fixes a little Solaris problem finding
> the m4 files during auto(re)conf.

Is this what:

+ACLOCAL_AMFLAGS = -Iconfig

solves?  I'm a little confused, b/c this should be automatic.

Al

On Mon, 2010-01-18 at 11:11 +1100, Andrew Wansink wrote:
> After a few hours of debugging why I could not talk to IPMI
> using the LAN driver under Solaris I found that MAXHOSTNAMELEN
> is defined in Sun's netdb.h header.
> 
> Worse, it is defined differently by FreeIPMI, this means that
> all the ipmi_ctx.io.outofband member addresses  after hostname
> are shifted when the ctx is passed from ipmi-chassis to routines
> in libfreeipmi.
> 
> I have attached a patch which checks for MAXHOSTNAMELEN in
> netdb.h and if found will include netdb.h before defining
> MAXHOSTNAMELEN.  Also it fixes a little Solaris problem finding
> the m4 files during auto(re)conf.
> 
> Andrew Wansink
> _______________________________________________
> Freeipmi-devel mailing list
> [email protected]
> http://*lists.gnu.org/mailman/listinfo/freeipmi-devel
-- 
Albert Chu
[email protected]
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
Index: ChangeLog
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/ChangeLog,v
retrieving revision 1.2438
diff -p -u -r1.2438 ChangeLog
--- ChangeLog	16 Jan 2010 00:33:21 -0000	1.2438
+++ ChangeLog	19 Jan 2010 03:39:11 -0000
@@ -1,3 +1,7 @@
+2010-01-18  Albert Chu <[email protected]>
+
+	* Fix portability issues to Solaris w/ MAXHOSTNAMELEN definition.
+	
 2010-01-15  Albert Chu <[email protected]>
 
 	* libfreeipmi/src/sel-parse/ipmi-sel-parse-string-sun.h,
Index: configure.ac
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/configure.ac,v
retrieving revision 1.188
diff -p -u -r1.188 configure.ac
--- configure.ac	8 Jan 2010 19:28:06 -0000	1.188
+++ configure.ac	19 Jan 2010 03:39:11 -0000
@@ -373,7 +373,7 @@ AC_HEADER_TIME
 AC_HEADER_SYS_WAIT
 dnl achu: note "strings.h" plural
 AC_CHECK_HEADERS([unistd.h fcntl.h getopt.h pthread.h strings.h])
-AC_CHECK_HEADERS([linux/types.h error.h sys/io.h sys/sockio.h asm/io.h sys/ioccom.h])
+AC_CHECK_HEADERS([linux/types.h error.h netdb.h sys/io.h sys/sockio.h asm/io.h sys/ioccom.h])
 AC_CHECK_HEADERS([linux/ipmi_msgdefs.h])
 AC_CHECK_HEADERS([linux/compiler.h])
 AC_CHECK_HEADERS([stropts.h sys/stropts.h])
Index: common/src/pingtool/ping-tool-common.c
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/common/src/pingtool/ping-tool-common.c,v
retrieving revision 1.20
diff -p -u -r1.20 ping-tool-common.c
--- common/src/pingtool/ping-tool-common.c	23 Dec 2009 21:23:18 -0000	1.20
+++ common/src/pingtool/ping-tool-common.c	19 Jan 2010 03:39:11 -0000
@@ -67,6 +67,10 @@
 #include <time.h>
 #endif  /* !HAVE_SYS_TIME_H */
 #endif /* !TIME_WITH_SYS_TIME */
+#include <limits.h>             /* MAXHOSTNAMELEN */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>              /* MAXHOSTNAMELEN Solaris */
+#endif /* HAVE_NETDB_H */
 #include <assert.h>
 
 #include <freeipmi/freeipmi.h>
Index: common/src/toolsdr/tool-sdr-cache-common.c
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/common/src/toolsdr/tool-sdr-cache-common.c,v
retrieving revision 1.4
diff -p -u -r1.4 tool-sdr-cache-common.c
--- common/src/toolsdr/tool-sdr-cache-common.c	23 Dec 2009 21:23:19 -0000	1.4
+++ common/src/toolsdr/tool-sdr-cache-common.c	19 Jan 2010 03:39:11 -0000
@@ -28,12 +28,15 @@
 #endif /* STDC_HEADERS */
 #include <pwd.h>
 #include <sys/param.h>
-#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif  /* HAVE_UNISTD_H */
+#include <limits.h>             /* MAXHOSTNAMELEN */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>              /* MAXHOSTNAMELEN Solaris */
+#endif /* HAVE_NETDB_H */
 #include <assert.h>
 #include <errno.h>
 
Index: ipmiconsole/src/libipmiconsole/ipmiconsole_defs.h
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/ipmiconsole/src/libipmiconsole/ipmiconsole_defs.h,v
retrieving revision 1.76
diff -p -u -r1.76 ipmiconsole_defs.h
--- ipmiconsole/src/libipmiconsole/ipmiconsole_defs.h	23 Dec 2009 21:23:22 -0000	1.76
+++ ipmiconsole/src/libipmiconsole/ipmiconsole_defs.h	19 Jan 2010 03:39:11 -0000
@@ -46,6 +46,10 @@
 #endif /* !TIME_WITH_SYS_TIME */
 #include <sys/param.h>
 #include <netinet/in.h>
+#include <limits.h>             /* MAXHOSTNAMELEN */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>              /* MAXHOSTNAMELEN Solaris */
+#endif /* HAVE_NETDB_H */
 #include <freeipmi/freeipmi.h>
 
 #include "scbuf.h"
Index: ipmidetect/src/ipmidetectd/ipmidetectd.h
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/ipmidetect/src/ipmidetectd/ipmidetectd.h,v
retrieving revision 1.9
diff -p -u -r1.9 ipmidetectd.h
--- ipmidetect/src/ipmidetectd/ipmidetectd.h	23 Dec 2009 21:23:23 -0000	1.9
+++ ipmidetect/src/ipmidetectd/ipmidetectd.h	19 Jan 2010 03:39:11 -0000
@@ -31,7 +31,10 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#include <limits.h>
+#include <limits.h>             /* MAXHOSTNAMELEN */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>              /* MAXHOSTNAMELEN Solaris */
+#endif /* HAVE_NETDB_H */
 
 #ifndef MAXHOSTNAMELEN
 #define MAXHOSTNAMELEN 64
Index: ipmimonitoring/src/libipmimonitoring/ipmi_monitoring_defs.h
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/ipmimonitoring/src/libipmimonitoring/ipmi_monitoring_defs.h,v
retrieving revision 1.34
diff -p -u -r1.34 ipmi_monitoring_defs.h
--- ipmimonitoring/src/libipmimonitoring/ipmi_monitoring_defs.h	8 Jan 2010 19:28:06 -0000	1.34
+++ ipmimonitoring/src/libipmimonitoring/ipmi_monitoring_defs.h	19 Jan 2010 03:39:11 -0000
@@ -27,10 +27,18 @@
 #ifndef _IPMI_MONITORING_DEFS_H
 #define _IPMI_MONITORING_DEFS_H
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
 #include <stdint.h>
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <limits.h>             /* MAXHOSTNAMELEN */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>              /* MAXHOSTNAMELEN Solaris */
+#endif /* HAVE_NETDB_H */
 #include <freeipmi/freeipmi.h>
 
 #include "list.h"
Index: ipmipower/src/ipmipower.h
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/ipmipower/src/ipmipower.h,v
retrieving revision 1.143
diff -p -u -r1.143 ipmipower.h
--- ipmipower/src/ipmipower.h	23 Dec 2009 21:23:24 -0000	1.143
+++ ipmipower/src/ipmipower.h	19 Jan 2010 03:39:11 -0000
@@ -43,6 +43,10 @@
 #endif /* !TIME_WITH_SYS_TIME */
 #include <sys/param.h>
 #include <netinet/in.h>
+#include <limits.h>             /* MAXHOSTNAMELEN */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>              /* MAXHOSTNAMELEN Solaris */
+#endif /* HAVE_NETDB_H */
 
 #include <freeipmi/freeipmi.h>
 
Index: libfreeipmi/src/api/ipmi-api-defs.h
===================================================================
RCS file: /cvsroot/freeipmi/freeipmi/libfreeipmi/src/api/ipmi-api-defs.h,v
retrieving revision 1.8
diff -p -u -r1.8 ipmi-api-defs.h
--- libfreeipmi/src/api/ipmi-api-defs.h	23 Dec 2009 21:23:29 -0000	1.8
+++ libfreeipmi/src/api/ipmi-api-defs.h	19 Jan 2010 03:39:11 -0000
@@ -37,6 +37,10 @@
 #include <time.h>
 #endif /* !HAVE_SYS_TIME_H */
 #endif  /* !TIME_WITH_SYS_TIME */
+#include <limits.h>             /* MAXHOSTNAMELEN */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>              /* MAXHOSTNAMELEN Solaris */
+#endif /* HAVE_NETDB_H */
 
 #include "freeipmi/cmds/ipmi-messaging-support-cmds.h"
 #include "freeipmi/fiid/fiid.h"
_______________________________________________
Freeipmi-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/freeipmi-devel

Reply via email to