[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] [PATCH 3/8] Compile libvirt under Windows (Cygwin)



PATH_MAX requires <sys/syslimits.h> on Cygwin.

HOST_NAME_MAX and IF_NAMESIZE aren't present at all on Cygwin, so if they are not defined hard code defaults for them. There shouldn't be a problem because we should still use functions which work if the actual values are longer than these default sizes.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.90
diff -u -r1.90 configure.in
--- configure.in	30 Sep 2007 21:09:29 -0000	1.90
+++ configure.in	24 Nov 2007 14:11:41 -0000
@@ -64,7 +64,7 @@
 AC_CHECK_FUNCS([regexec])
 
 dnl Availability of various common headers (non-fatal if missing).
-AC_CHECK_HEADERS(paths.h)
+AC_CHECK_HEADERS([paths.h sys/syslimits.h])
 
 dnl Specific dir for HTML output ?
 AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
Index: src/internal.h
===================================================================
RCS file: /data/cvs/libvirt/src/internal.h,v
retrieving revision 1.53
diff -u -r1.53 internal.h
--- src/internal.h	14 Nov 2007 11:40:57 -0000	1.53
+++ src/internal.h	24 Nov 2007 14:11:41 -0000
@@ -12,6 +12,23 @@
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <libxml/threads.h>
+#ifdef HAVE_SYS_SYSLIMITS_H
+#include <sys/syslimits.h>
+#endif
+
+/* On architectures which lack these limits, define them (ie. Cygwin).
+ * Note that the libvirt code should be robust enough to handle the
+ * case where actual value is longer than these limits (eg. by setting
+ * length correctly in second argument to gethostname and by always
+ * using strncpy instead of strcpy).
+ */
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 256
+#endif
+
+#ifndef IF_NAMESIZE
+#define IF_NAMESIZE 16
+#endif
 
 #include "hash.h"
 #include "libvirt/libvirt.h"
Index: src/xml.c
===================================================================
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.99
diff -u -r1.99 xml.c
--- src/xml.c	6 Nov 2007 11:49:01 -0000	1.99
+++ src/xml.c	24 Nov 2007 14:20:56 -0000
@@ -8,12 +8,15 @@
  * Daniel Veillard <veillard redhat com>
  */
 
+#include "config.h"
+
 #include "libvirt/libvirt.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
+#include <limits.h>
 #ifdef WITH_XEN
 #include <xs.h>
 #endif

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]