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

[Libvir] 14/22 No uname function



Windows doesn't have uname or <sys/utsname.h>.

We can't get the model info without more delving into the Win32 API. This just disables the functionality temporarily, but a proper fix will be to find out how to do this under Windows.

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/nodeinfo.c
===================================================================
RCS file: /data/cvs/libvirt/src/nodeinfo.c,v
retrieving revision 1.4
diff -u -r1.4 nodeinfo.c
--- src/nodeinfo.c	5 Dec 2007 21:40:15 -0000	1.4
+++ src/nodeinfo.c	7 Dec 2007 10:54:32 -0000
@@ -26,10 +26,13 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <sys/utsname.h>
 #include <errno.h>
 #include <ctype.h>
 
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
 #include "nodeinfo.h"
 #include "physmem.h"
 
@@ -120,6 +123,7 @@
 
 int virNodeInfoPopulate(virConnectPtr conn,
                         virNodeInfoPtr nodeinfo) {
+#ifdef HAVE_UNAME
     struct utsname info;
 
     if (uname(&info) < 0) {
@@ -128,10 +132,15 @@
                         "cannot extract machine type %s", strerror(errno));
         return -1;
     }
-
     strncpy(nodeinfo->model, info.machine, sizeof(nodeinfo->model)-1);
     nodeinfo->model[sizeof(nodeinfo->model)-1] = '\0';
 
+#else /* !HAVE_UNAME */
+
+    nodeinfo->model[0] = '\0';
+
+#endif /* !HAVE_UNAME */
+
 #ifdef __linux__
     {
     int ret;

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


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