]> xenbits.xensource.com Git - libvirt.git/commitdiff
Use gnulib, starting with its physmem and getaddrinfo modules.
authorJim Meyering <meyering@redhat.com>
Wed, 5 Dec 2007 21:31:07 +0000 (21:31 +0000)
committerJim Meyering <meyering@redhat.com>
Wed, 5 Dec 2007 21:31:07 +0000 (21:31 +0000)
New files go into these directories:
  gnulib/lib
  gnulib/m4
  gnulib/tests

* bootstrap: A wrapper around gnulib-tool.
* configure.in: Invoke gl_EARLY and gl_INIT, being careful to put gl_EARLY
before any macro that uses AC_COMPILE_IFELSE.
(AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile.  Remove m4/Makefile.
* Makefile.am (SUBDIRS): Add gnulib/lib and remove m4.  Add gnulib/tests
early enough that those tests run before any libvirt unit tests.
* m4/Makefile.am: Remove file.  Not needed.
* src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
* src/nodeinfo.c: Include "physmem.h".
* qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
(MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
(virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
* tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS): Add ../gnulib/lib/libgnu.la.
* qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
* tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
memory from a file.
Update expected output not to include "Memory: NNNN"
* tests/nodeinfodata/linux-nodeinfo-1.txt:
* tests/nodeinfodata/linux-nodeinfo-2.txt:
* tests/nodeinfodata/linux-nodeinfo-3.txt:
* tests/nodeinfodata/linux-nodeinfo-4.txt:
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
would conflict with the one now in "config.h".
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
Instead, include "config.h".
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.

* configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
of gettextize-generated files go into build-aux/, rather than in
the top-level directory.
* .cvsignore: Adjust.
* build-aux/.cvsignore: New file.

Author: Jim Meyering <meyering@redhat.com>

26 files changed:
.cvsignore
ChangeLog
Makefile.am
autogen.sh
bootstrap [new file with mode: 0755]
build-aux/.cvsignore [new file with mode: 0644]
configure.in
m4/Makefile.am [deleted file]
qemud/Makefile.am
qemud/qemud.c
src/Makefile.am
src/conf.c
src/nodeinfo.c
src/openvz_driver.c
src/qemu_driver.c
src/remote_internal.c
src/sexpr.c
src/test.c
tests/Makefile.am
tests/nodeinfodata/linux-nodeinfo-1.txt
tests/nodeinfodata/linux-nodeinfo-2.txt
tests/nodeinfodata/linux-nodeinfo-3.txt
tests/nodeinfodata/linux-nodeinfo-4.txt
tests/nodeinfodata/linux-nodeinfo-5.txt
tests/nodeinfodata/linux-nodeinfo-6.txt
tests/nodeinfotest.c

index 90819147fd4f8e9c29e176bf4aaf2dffbfe74582..a35d5ea14c74f8a6168cd3c26c2628f235cb50c0 100644 (file)
@@ -9,27 +9,18 @@ config.cache
 config.h
 config.h.in
 config.log
-config.guess
 config.status
-config.sub
 stamp-h
 stamp-h1
 libtool
 ltconfig
-ltmain.sh
 update.log
 libvirt.pc
 libvirt.spec
 COPYING
 m4
 ABOUT-NLS
-config.rpath
-mkinstalldirs
 coverage
 results.log
 libvirt-*.tar.gz
 INSTALL
-compile
-depcomp
-install-sh
-missing
index 60c0a9d6e9a4c4d94e19a434de0668d619ff63ad..a18ac2a2b65111842b466e6393de67b3749c90d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,53 @@
+Wed Dec  5 22:30:03 CET 2007 Jim Meyering <meyering@redhat.com>
+
+       Use gnulib, starting with its physmem and getaddrinfo modules.
+       New files go into these directories:
+         gnulib/lib
+         gnulib/m4
+         gnulib/tests
+       * bootstrap: A wrapper around gnulib-tool.
+       * configure.in: Invoke gl_EARLY and gl_INIT, being careful to put
+       gl_EARLY before any macro that uses AC_COMPILE_IFELSE.
+       (AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile.  Remove m4/Makefile.
+       * Makefile.am (SUBDIRS): Add gnulib/lib and remove m4.  Add gnulib/tests
+       early enough that those tests run before any libvirt unit tests.
+       * m4/Makefile.am: Remove file.  Not needed.
+       * src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib
+       -I../gnulib/lib.
+       (LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
+       * src/nodeinfo.c: Include "physmem.h".
+       * qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
+       (MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
+       (virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
+       * tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib
+       -I../gnulib/lib.
+       (LDADDS): Add ../gnulib/lib/libgnu.la.
+       * qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
+       * tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
+       memory from a file.
+       Update expected output not to include "Memory: NNNN"
+       * tests/nodeinfodata/linux-nodeinfo-1.txt:
+       * tests/nodeinfodata/linux-nodeinfo-2.txt:
+       * tests/nodeinfodata/linux-nodeinfo-3.txt:
+       * tests/nodeinfodata/linux-nodeinfo-4.txt:
+       * tests/nodeinfodata/linux-nodeinfo-5.txt:
+       * tests/nodeinfodata/linux-nodeinfo-6.txt:
+       * src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
+       would conflict with the one now in "config.h".
+       * autogen.sh: Add -I gnulib/m4.
+       * src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
+       Instead, include "config.h".
+       * qemud/qemud.c: Remove definition of _GNU_SOURCE.
+       * src/openvz_driver.c: Likewise.
+       * src/qemu_driver.c: Likewise.
+       * src/remote_internal.c: Likewise.
+
+       * configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
+       of gettextize-generated files go into build-aux/, rather than in
+       the top-level directory.
+       * .cvsignore: Adjust.
+       * build-aux/.cvsignore: New file.
+
 Wed Dec  5 21:44:17 CET 2007 Daniel Veillard <veillard@redhat.com>
 
        * qemud/remote.c: rename remoteDispatchAuthPolkitInit to
index 03e80627df14514c0f634b56618354a90603c0f2..c49c533c2cde1e698ce193cc2f7df0c1b8876ae4 100644 (file)
@@ -1,8 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = include src qemud proxy docs @PYTHON_SUBDIR@ tests po m4 scripts
+SUBDIRS = gnulib/lib include src qemud proxy docs gnulib/tests \
+  @PYTHON_SUBDIR@ tests po scripts
 
-ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4
 
 EXTRA_DIST = libvirt.spec.in libvirt.spec COPYING.LIB \
              libvirt.pc.in libvirt.pc TODO AUTHORS ChangeLog \
index 97b636dac7ca9ecf9b498ba9803e20ee164b30e7..3bcffd3d944435c6dab816ed79f56144c5eabd96 100755 (executable)
@@ -57,7 +57,7 @@ fi
 autopoint --force
 #rm -rf m4
 libtoolize --copy --force
-aclocal -I m4
+aclocal -I m4 -I gnulib/m4
 autoheader
 automake --add-missing
 autoconf
diff --git a/bootstrap b/bootstrap
new file mode 100755 (executable)
index 0000000..73ad3f6
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,117 @@
+#!/bin/sh
+# Run this after autogen.sh, to pull in all of the gnulib-related bits.
+# It's important to run *after* autogen.sh, since it updates some of
+# the same files autogen.sh does, yet those from gnulib are newer,
+# and match the tests.  So if a gnulib bug has been fixed since the
+# snapshot taken for whatever gettext release you're using, yet you
+# run "make check" against the wrong version, the corresponding unit
+# test in gl-tests/ may well fail.
+
+usage() {
+  echo >&2 "\
+Usage: $0 [OPTION]...
+Bootstrap this package from the checked-out sources.
+
+Options:
+ --gnulib-srcdir=DIRNAME  Specify the local directory where gnulib
+                          sources reside.  Use this if you already
+                          have gnulib sources on your machine, and
+                          do not want to waste your bandwidth downloading
+                          them again.
+
+If the file bootstrap.conf exists in the current working directory, its
+contents are read as shell variables to configure the bootstrap.
+
+Running without arguments will suffice in most cases.
+"
+}
+
+for option
+do
+  case $option in
+  --help)
+    usage
+    exit;;
+  --gnulib-srcdir=*)
+    GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
+  *)
+    echo >&2 "$0: $option: unknown option"
+    exit 1;;
+  esac
+done
+
+cleanup_gnulib() {
+  st=$?
+  rm -fr .gnulib
+  exit $st
+}
+
+case ${GNULIB_SRCDIR--} in
+-)
+  if [ ! -d gnulib ]; then
+    echo "$0: getting gnulib files..."
+
+    trap cleanup_gnulib 1 2 13 15
+
+    git clone --depth 1 git://git.sv.gnu.org/gnulib .gnulib ||
+      cleanup_gnulib
+
+    trap - 1 2 13 15
+  fi
+  GNULIB_SRCDIR=.gnulib
+esac
+
+gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
+<$gnulib_tool || exit
+
+# Tell gnulib to:
+#   put tests in new gnulib/tests/ dir
+#   put *.m4 files in new gnulib/m4/ dir
+#   put *.[ch] files in new gnulib/lib/ dir.
+# With --avoid=snprintf, we drop support for systems (many!) with
+# losing snprintf but pull in about 30 fewer files
+# With the current gnulib and gettext-0.17, the following
+# files are added to m4/ by both.  But gnulib is stable enough
+# and gettext-0.16.1 is new enough that they are identical.
+#   compiler-flags.m4
+#   inttypes_h.m4
+#   longlong.m4
+#   size_max.m4
+#   stdint_h.m4
+#   wchar_t.m4
+#   wint_t.m4
+#   xsize.m4
+
+# Note that if we don't exclude the snprintf module, there are two tests
+# that have incompatible licenses, so we would have to exclude them.  Even
+# excluding those two test modules, find reports a total of 94 added files.
+# Yes, snprintf has some heavy-duty dependents.
+#  --avoid=snprintf-tests
+#  --avoid=vasnprintf-tests
+
+avoid='--avoid=snprintf'
+
+avoid='
+  --avoid=snprintf-tests
+  --avoid=vasnprintf-tests
+  --avoid=alloca-opt-tests
+'
+
+$gnulib_tool                   \
+  --lgpl                       \
+  $avoid                       \
+  --with-tests                 \
+  --m4-base=gnulib/m4          \
+  --source-base=gnulib/lib     \
+  --tests-base=gnulib/tests    \
+  --import physmem getaddrinfo
+
+rm -f                          \
+    .gitignore                 \
+    gnulib/lib/.gitignore      \
+    gnulib/m4/.gitignore       \
+    gnulib/tests/.gitignore
+
+(cd gnulib/lib &&
+ (cat .cvsignore; \
+  ls -1 *.in.h|sed 's/\.in\.h/.h/') | sort -u > .t; mv .t .cvsignore)
diff --git a/build-aux/.cvsignore b/build-aux/.cvsignore
new file mode 100644 (file)
index 0000000..1798f40
--- /dev/null
@@ -0,0 +1,9 @@
+compile
+config.guess
+config.rpath
+config.sub
+depcomp
+install-sh
+ltmain.sh
+missing
+mkinstalldirs
index b11458b187677c1e0000461a69fe56734424c2c1..7c014cfbf14ada285edd8fa1e24557345554468b 100644 (file)
@@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT(libvirt, 0.3.3)
 AC_CONFIG_SRCDIR(src/libvirt.c)
+AC_CONFIG_AUX_DIR(build-aux)
 AM_CONFIG_HEADER(config.h)
 dnl Make automake keep quiet about wildcards & other GNUmake-isms
 AM_INIT_AUTOMAKE([-Wno-portability])
@@ -29,11 +30,15 @@ POLKIT_REQUIRED="0.6"
 
 dnl Checks for C compiler.
 AC_PROG_CC
-AM_PROG_CC_STDC
-AC_C_CONST
 AC_PROG_INSTALL
 AC_PROG_CPP
 
+gl_EARLY
+gl_INIT
+
+AM_PROG_CC_STDC
+AC_C_CONST
+
 dnl Make sure we have an ANSI compiler
 AM_C_PROTOTYPES
 test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
@@ -626,11 +631,12 @@ cp COPYING.LIB COPYING
 AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
           docs/examples/Makefile docs/devhelp/Makefile \
          docs/examples/python/Makefile \
+         gnulib/lib/Makefile tests/gnulib/Makefile \
           libvirt.pc libvirt.spec \
           po/Makefile.in scripts/Makefile \
          include/libvirt/Makefile include/libvirt/libvirt.h \
          python/Makefile python/tests/Makefile \
-          qemud/Makefile m4/Makefile \
+          qemud/Makefile \
           tests/Makefile proxy/Makefile \
           tests/xml2sexprdata/Makefile \
           tests/sexpr2xmldata/Makefile \
diff --git a/m4/Makefile.am b/m4/Makefile.am
deleted file mode 100644 (file)
index 188b2fe..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-EXTRA_DIST = compiler-flags.m4
-
index c605e1f9f34b7f557d6ebb30dc071fc6f6f2a67b..ef940014b7860723c75818c685554e416c610270 100644 (file)
@@ -28,6 +28,7 @@ libvirtd_SOURCES = \
 
 #-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
 libvirtd_CFLAGS = \
+        -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
         -I$(top_srcdir)/include -I$(top_builddir)/include \
         $(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
         $(POLKIT_CFLAGS) \
@@ -40,7 +41,7 @@ libvirtd_CFLAGS = \
 libvirtd_LDFLAGS = $(WARN_CFLAGS) $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) \
                    $(POLKIT_LIBS)
 libvirtd_DEPENDENCIES = ../src/libvirt.la
-libvirtd_LDADD = ../src/libvirt.la
+libvirtd_LDADD = ../src/libvirt.la ../gnulib/lib/libgnu.la
 
 
 if HAVE_POLKIT
index 657b6ffa076e62c776f83a4898d5a14b4e4bdf47..20a3b08a9af4615625485ce3e3a597b84236ea7c 100644 (file)
@@ -23,8 +23,6 @@
 
 #include "config.h"
 
-#define _GNU_SOURCE /* for asprintf */
-
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
@@ -53,6 +51,7 @@
 #include "libvirt/virterror.h"
 
 #include "internal.h"
+#include "getaddrinfo.h"
 #include "../src/internal.h"
 #include "../src/remote_internal.h"
 #include "../src/conf.h"
index 532c7da1c45ae0e3d558ec3f16c57c8aa13e7902..a14b9b6eac63e5c3ee9d16ece872b1b09665df8b 100644 (file)
@@ -1,6 +1,8 @@
 ## Process this file with automake to produce Makefile.in
 
-INCLUDES = -I$(top_builddir)/include \
+INCLUDES = \
+          -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
+          -I../include \
           -I@top_srcdir@/include \
           -I@top_srcdir@/qemud \
           $(LIBXML_CFLAGS) \
@@ -15,7 +17,7 @@ INCLUDES = -I$(top_builddir)/include \
           $(WARN_CFLAGS) \
           $(LIBVIRT_FEATURES)
 DEPS = libvirt.la
-LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) libvirt.la
+LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) libvirt.la ../gnulib/lib/libgnu.la
 VIRSH_LIBS = @VIRSH_LIBS@
 
 confdir = $(sysconfdir)/libvirt/
@@ -61,7 +63,7 @@ SERVER_SOURCES =                                              \
 
 libvirt_la_SOURCES = $(CLIENT_SOURCES) $(SERVER_SOURCES)
 libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) \
-                   @CYGWIN_EXTRA_LIBADD@
+                   @CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la
 libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
                      -version-info @LIBVIRT_VERSION_INFO@ \
                     $(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
index 635792c68954b4e13be221a670472b8084f2f025..4c725bf046e94005620b1ffb8d8715479e7e8ae9 100644 (file)
@@ -8,7 +8,8 @@
  * Daniel Veillard <veillard@redhat.com>
  */
 
-#define _GNU_SOURCE /* want strndup ! */
+#include "config.h"
+
 #include <string.h>
 
 #include <stdio.h>
index a0a26eb16bf7798420fbc5f12b70fa188e6bd30f..2ef49cb65578d5f9b8ece56f5e8bf6e23cc7a7c9 100644 (file)
 #include <ctype.h>
 
 #include "nodeinfo.h"
+#include "physmem.h"
 
 #ifdef __linux__
-#define MEMINFO_PATH "/proc/meminfo"
 #define CPUINFO_PATH "/proc/cpuinfo"
 
 /* NB, these are not static as we need to call them from testsuite */
-int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr nodeinfo);
-int linuxNodeInfoMemPopulate(virConnectPtr conn, FILE *meminfo, virNodeInfoPtr nodeinfo);
+int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
+                             virNodeInfoPtr nodeinfo);
 
 int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr nodeinfo) {
     char line[1024];
@@ -114,44 +114,11 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
     return 0;
 }
 
-
-int linuxNodeInfoMemPopulate(virConnectPtr conn, FILE *meminfo,
-                             virNodeInfoPtr nodeinfo) {
-    char line[1024];
-
-    nodeinfo->memory = 0;
-
-    while (fgets(line, sizeof(line), meminfo) != NULL) {
-        if (STREQLEN(line, "MemTotal:", 9)) {
-            char *p;
-            unsigned int ui;
-            if (xstrtol_ui(line + 10, &p, 10, &ui) == 0
-                && (*p == '\0' || isspace(*p))) {
-                nodeinfo->memory = ui;
-                break;
-            }
-        }
-    }
-    if (!nodeinfo->memory) {
-        __virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
-                        VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                        "no memory found");
-        return -1;
-    }
-
-    return 0;
-}
-
-
 #endif
 
 int virNodeInfoPopulate(virConnectPtr conn,
                         virNodeInfoPtr nodeinfo) {
     struct utsname info;
-#ifdef __linux__
-    int ret;
-    FILE *cpuinfo, *meminfo;
-#endif
 
     if (uname(&info) < 0) {
         __virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
@@ -164,7 +131,9 @@ int virNodeInfoPopulate(virConnectPtr conn,
     nodeinfo->model[sizeof(nodeinfo->model)-1] = '\0';
 
 #ifdef __linux__
-    cpuinfo = fopen(CPUINFO_PATH, "r");
+    {
+    int ret;
+    FILE *cpuinfo = fopen(CPUINFO_PATH, "r");
     if (!cpuinfo) {
         __virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
                         VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
@@ -176,17 +145,11 @@ int virNodeInfoPopulate(virConnectPtr conn,
     if (ret < 0)
         return -1;
 
-    meminfo = fopen(MEMINFO_PATH, "r");
-    if (!meminfo) {
-        __virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
-                        VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
-                        "cannot open %s %s", MEMINFO_PATH, strerror(errno));
-        return -1;
-    }
-    ret = linuxNodeInfoMemPopulate(conn, meminfo, nodeinfo);
-    fclose(meminfo);
+    /* Convert to KB. */
+    nodeinfo->memory = physmem_total () / 1024;
 
     return ret;
+    }
 #else
     /* XXX Solaris will need an impl later if they port QEMU driver */
     __virRaiseError(conn, NULL, NULL, 0, VIR_ERR_INTERNAL_ERROR,
index f51725df66695f4741c52b0c873787fc66093ec7..7f6d0cd3d0c60613f0a2ff7216ddc5dbc1f0c863 100644 (file)
@@ -29,8 +29,6 @@
 
 #include <config.h>
 
-#define _GNU_SOURCE /* for asprintf */
-
 #include <sys/types.h>
 #include <sys/poll.h>
 #include <dirent.h>
index dfed44655949bb029eb5e21ad92b92171164dae7..8c3e0af423872bc72a26858f5dbe286112dfc0b9 100644 (file)
@@ -25,8 +25,6 @@
 
 #ifdef WITH_QEMU
 
-#define _GNU_SOURCE /* for asprintf */
-
 #include <sys/types.h>
 #include <sys/poll.h>
 #include <dirent.h>
index edadc5622fabe67073aaf93641da41b9b1d54488..8be86abc78ddabacebc5d287a046190de21bfbc3 100644 (file)
@@ -21,8 +21,6 @@
  * Author: Richard Jones <rjones@redhat.com>
  */
 
-#define _GNU_SOURCE /* for asprintf */
-
 #include "config.h"
 
 #include <stdio.h>
@@ -55,6 +53,7 @@
 
 #include "internal.h"
 #include "driver.h"
+#include "getaddrinfo.h"
 #include "remote_internal.h"
 #include "remote_protocol.h"
 
index 8412f22c26162ac69e747fcbb4b3a245a760e312..97d5ca2c51d7b9091cbc372b3fa0140354b7f71c 100644 (file)
@@ -10,7 +10,7 @@
  *  archive for more details.
  */
 
-#define _GNU_SOURCE /* for strndup */
+#include "config.h"
 
 #include "sexpr.h"
 #include "internal.h"
index e7f069cfa1a87d29aed76c498606b4afc3e21846..9926ac17358e80acc1f32ff30d0437c1d5c6b04b 100644 (file)
@@ -25,8 +25,6 @@
 
 #ifdef WITH_TEST
 
-#define _GNU_SOURCE /* for asprintf */
-
 #include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
index cf96419ea73bb0f7ec7eac5bad1ab2d435e0d966..bec8b05be6e7c1f1f313a5fd65b283ceb6f5fd31 100644 (file)
@@ -1,6 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = virshdata confdata sexpr2xmldata xml2sexprdata xmconfigdata xencapsdata
+SUBDIRS = virshdata confdata sexpr2xmldata \
+  xml2sexprdata xmconfigdata xencapsdata
 
 # Wierd libtool related juju...
 #
@@ -11,6 +12,7 @@ SUBDIRS = virshdata confdata sexpr2xmldata xml2sexprdata xmconfigdata xencapsdat
 LIBVIRT = $(wildcard $(top_builddir)/src/.libs/libvirt_la-*.o)
 
 INCLUDES = \
+       -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
        -I$(top_builddir)/include \
        -I$(top_builddir)/src \
        -I$(top_srcdir)/include \
@@ -31,6 +33,7 @@ LDADDS = \
         $(SASL_LIBS) \
         $(WARN_CFLAGS) \
        $(LIBVIRT) \
+       ../gnulib/lib/libgnu.la \
         $(COVERAGE_LDFLAGS)
 
 EXTRA_DIST =           \
index 1a38ad1822bda04d713c435b76ba7ddc795102c9..e52e20ab72fe9cec44472cba38bddbdb393608d7 100644 (file)
@@ -1 +1 @@
-CPUs: 2, MHz: 2800, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1, Memory: 2053960
+CPUs: 2, MHz: 2800, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1
index 1c31a0c82cec7696446f53dcb6e2271e49c69c0b..12e819ba7d9b99600c1a59b19b439eec5ec07e6b 100644 (file)
@@ -1 +1 @@
-CPUs: 2, MHz: 2211, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1, Memory: 4059540
+CPUs: 2, MHz: 2211, Nodes: 1, Sockets: 1, Cores: 2, Threads: 1
index e2cc841172f65199118df416fb46f5589613fa4b..d285781507b665b84ad5c10ca5d63a5733788de6 100644 (file)
@@ -1 +1 @@
-CPUs: 4, MHz: 1595, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1, Memory: 4059272
+CPUs: 4, MHz: 1595, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1
index 2c75ea3552b724ed69ad492bb36baea477ab9c2d..991d4f93e08bad485ddff947b339fde911ff8f1b 100644 (file)
@@ -1 +1 @@
-CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 1, Cores: 4, Threads: 1, Memory: 4059272
+CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 1, Cores: 4, Threads: 1
index 01fee523ac011d2b0d70f6c5ca98e6e35114ebf0..dce7ada3e44943490ecfba81f3b29dbf0f1f21f0 100644 (file)
@@ -1 +1 @@
-CPUs: 4, MHz: 2814, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1, Memory: 4059272
+CPUs: 4, MHz: 2814, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1
index a7a2cfe5cf79a80fc797c73617299e6a527cfdee..75cdaa97222cb96d59589b02fdaa5b2968130d40 100644 (file)
@@ -1 +1 @@
-CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1, Memory: 4059272
+CPUs: 4, MHz: 1000, Nodes: 1, Sockets: 2, Cores: 2, Threads: 1
index 1caef11d9897449f7e694f367618601e8558ef21..969b85c5f07d92b8ff2c1c463002db7b4d675939 100644 (file)
@@ -16,14 +16,13 @@ static char *abs_top_srcdir;
 #ifdef __linux__
 
 extern int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr nodeinfo);
-extern int linuxNodeInfoMemPopulate(virConnectPtr conn, FILE *meminfo, virNodeInfoPtr nodeinfo);
 
-static int linuxTestCompareFiles(const char *cpuinfofile, const char *meminfofile, const char *outputfile) {
+static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile) {
     char actualData[MAX_FILE];
     char expectData[MAX_FILE];
     char *expect = &expectData[0];
     virNodeInfo nodeinfo;
-    FILE *cpuinfo, *meminfo;
+    FILE *cpuinfo;
 
     if (virtTestLoadFile(outputfile, &expect, MAX_FILE) < 0)
         return -1;
@@ -37,19 +36,10 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *meminfofil
     }
     fclose(cpuinfo);
 
-    meminfo = fopen(meminfofile, "r");
-    if (!meminfo)
-        return -1;
-    if (linuxNodeInfoMemPopulate(NULL, meminfo, &nodeinfo) < 0) {
-        fclose(meminfo);
-        return -1;
-    }
-    fclose(meminfo);
-
     snprintf(actualData, MAX_FILE,
-             "CPUs: %u, MHz: %u, Nodes: %u, Sockets: %u, Cores: %u, Threads: %u, Memory: %lu\n",
+             "CPUs: %u, MHz: %u, Nodes: %u, Sockets: %u, Cores: %u, Threads: %u\n",
              nodeinfo.cpus, nodeinfo.mhz, nodeinfo.nodes, nodeinfo.sockets,
-             nodeinfo.cores, nodeinfo.threads, nodeinfo.memory);
+             nodeinfo.cores, nodeinfo.threads);
 
     if (STRNEQ(actualData, expectData)) {
         if (getenv("DEBUG_TESTS")) {
@@ -65,15 +55,12 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *meminfofil
 
 static int linuxTestNodeInfo(const void *data) {
     char cpuinfo[PATH_MAX];
-    char meminfo[PATH_MAX];
     char output[PATH_MAX];
     snprintf(cpuinfo, PATH_MAX, "%s/tests/nodeinfodata/linux-%s.cpuinfo",
              abs_top_srcdir, (const char*)data);
-    snprintf(meminfo, PATH_MAX, "%s/tests/nodeinfodata/linux-%s.meminfo",
-             abs_top_srcdir, (const char*)data);
     snprintf(output, PATH_MAX, "%s/tests/nodeinfodata/linux-%s.txt",
              abs_top_srcdir, (const char*)data);
-    return linuxTestCompareFiles(cpuinfo, meminfo, output);
+    return linuxTestCompareFiles(cpuinfo, output);
 }
 #endif