[libvirt] [PATCHv2 2/5] build: use gnulib's uname

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

 



* bootstrap.conf (gnulib_modules): Add uname.
* configure.ac: Drop uname and sys/utsname.h checks.
* src/nodeinfo.c (nodeGetInfo): Use uname unconditionally.
---
 bootstrap.conf |    1 +
 configure.ac   |    4 ++--
 src/nodeinfo.c |   12 ++----------
 3 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index da7cc9c..e85f869 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -59,6 +59,7 @@ strtok_r
 sys_stat
 time_r
 timegm
+uname
 useless-if-before-free
 usleep
 vasprintf
diff --git a/configure.ac b/configure.ac
index 93eb654..18da606 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,7 +106,7 @@ dnl Use --disable-largefile if you don't want this.
 AC_SYS_LARGEFILE

 dnl Availability of various common functions (non-fatal if missing).
-AC_CHECK_FUNCS_ONCE([cfmakeraw regexec uname sched_getaffinity getuid getgid \
+AC_CHECK_FUNCS_ONCE([cfmakeraw regexec sched_getaffinity getuid getgid \
  posix_fallocate mmap])

 dnl Availability of various not common threadsafe functions
@@ -121,7 +121,7 @@ AC_CHECK_FUNCS([pthread_sigmask pthread_mutexattr_init])
 LIBS=$old_libs

 dnl Availability of various common headers (non-fatal if missing).
-AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h \
+AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h \
   sys/wait.h sched.h termios.h sys/poll.h syslog.h mntent.h net/ethernet.h])

 dnl Where are the XDR functions?
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 4d7fac1..5ec1bcf 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -29,16 +29,13 @@
 #include <stdint.h>
 #include <errno.h>
 #include <dirent.h>
+#include <sys/utsname.h>

 #if HAVE_NUMACTL
 # define NUMA_VERSION1_COMPATIBILITY 1
 # include <numa.h>
 #endif

-#ifdef HAVE_SYS_UTSNAME_H
-# include <sys/utsname.h>
-#endif
-
 #include "c-ctype.h"
 #include "memory.h"
 #include "nodeinfo.h"
@@ -273,18 +270,13 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
 #endif

 int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
-    memset(nodeinfo, 0, sizeof(*nodeinfo));
-
-#ifdef HAVE_UNAME
-    {
     struct utsname info;

+    memset(nodeinfo, 0, sizeof(*nodeinfo));
     uname(&info);

     if (virStrcpyStatic(nodeinfo->model, info.machine) == NULL)
         return -1;
-    }
-#endif /* !HAVE_UNAME */

 #ifdef __linux__
     {
-- 
1.6.6.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]