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

[Libvir] 18/22 Misc headers



Miscellaneous changes to headers. The important one is that if <winsock2.h> is available then that replaces all of the usual socket- and network database-related headers (which are not available in Windows). Thus you end up with code like this:

#ifndef HAVE_WINSOCK2_H
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#else
#include <winsock2.h>
#endif

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: src/remote_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.44
diff -u -r1.44 remote_internal.c
--- src/remote_internal.c	6 Dec 2007 12:05:35 -0000	1.44
+++ src/remote_internal.c	7 Dec 2007 11:00:58 -0000
@@ -31,15 +31,29 @@
 #include <errno.h>
 #include <signal.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
 #include <fcntl.h>
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#ifdef HAVE_PATHS_H
 #include <paths.h>
+#endif
+
+#ifndef HAVE_WINSOCK2_H
+#include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
-#include <pwd.h>
+#else
+#include <winsock2.h>
+#endif
 
 #include <rpc/types.h>
 #include <rpc/xdr.h>
Index: src/test.c
===================================================================
RCS file: /data/cvs/libvirt/src/test.c,v
retrieving revision 1.54
diff -u -r1.54 test.c
--- src/test.c	5 Dec 2007 21:31:07 -0000	1.54
+++ src/test.c	7 Dec 2007 11:03:35 -0000
@@ -35,8 +35,14 @@
 #include <libxml/uri.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <sys/stat.h>
+
+#ifndef HAVE_WINSOCK2_H
 #include <net/if.h>
 #include <netinet/in.h>
+#else
+#include <winsock2.h>
+#endif
 
 #include "internal.h"
 #include "test.h"
Index: src/util.c
===================================================================
RCS file: /data/cvs/libvirt/src/util.c,v
retrieving revision 1.9
diff -u -r1.9 util.c
--- src/util.c	5 Dec 2007 13:56:22 -0000	1.9
+++ src/util.c	7 Dec 2007 11:04:14 -0000
@@ -30,12 +30,15 @@
 #include <stdarg.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <paths.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
 
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+
 #include "libvirt/virterror.h"
 #include "internal.h"
 #include "event.h"
Index: src/xen_unified.h
===================================================================
RCS file: /data/cvs/libvirt/src/xen_unified.h,v
retrieving revision 1.10
diff -u -r1.10 xen_unified.h
--- src/xen_unified.h	5 Dec 2007 13:56:22 -0000	1.10
+++ src/xen_unified.h	7 Dec 2007 11:04:39 -0000
@@ -13,8 +13,12 @@
 
 #include "internal.h"
 
+#ifndef HAVE_WINSOCK2_H
 #include <sys/un.h>
 #include <netinet/in.h>
+#else
+#include <winsock2.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {

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


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