build: use gnulib's uname

* bootstrap.conf (gnulib_modules): Add uname.
* configure.ac: Drop uname and sys/utsname.h checks.
* src/nodeinfo.c (nodeGetInfo): Use uname unconditionally.
This commit is contained in:
Eric Blake 2010-04-28 21:06:46 -06:00
parent 9017b9bcaf
commit 5349cf1ed2
3 changed files with 5 additions and 12 deletions

View File

@ -59,6 +59,7 @@ strtok_r
sys_stat sys_stat
time_r time_r
timegm timegm
uname
useless-if-before-free useless-if-before-free
usleep usleep
vasprintf vasprintf

View File

@ -106,7 +106,7 @@ dnl Use --disable-largefile if you don't want this.
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
dnl Availability of various common functions (non-fatal if missing). 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]) posix_fallocate mmap])
dnl Availability of various not common threadsafe functions dnl Availability of various not common threadsafe functions
@ -121,7 +121,7 @@ AC_CHECK_FUNCS([pthread_sigmask pthread_mutexattr_init])
LIBS=$old_libs LIBS=$old_libs
dnl Availability of various common headers (non-fatal if missing). 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]) sys/wait.h sched.h termios.h sys/poll.h syslog.h mntent.h net/ethernet.h])
dnl Where are the XDR functions? dnl Where are the XDR functions?

View File

@ -29,16 +29,13 @@
#include <stdint.h> #include <stdint.h>
#include <errno.h> #include <errno.h>
#include <dirent.h> #include <dirent.h>
#include <sys/utsname.h>
#if HAVE_NUMACTL #if HAVE_NUMACTL
# define NUMA_VERSION1_COMPATIBILITY 1 # define NUMA_VERSION1_COMPATIBILITY 1
# include <numa.h> # include <numa.h>
#endif #endif
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#include "c-ctype.h" #include "c-ctype.h"
#include "memory.h" #include "memory.h"
#include "nodeinfo.h" #include "nodeinfo.h"
@ -273,18 +270,13 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
#endif #endif
int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) { int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
memset(nodeinfo, 0, sizeof(*nodeinfo));
#ifdef HAVE_UNAME
{
struct utsname info; struct utsname info;
memset(nodeinfo, 0, sizeof(*nodeinfo));
uname(&info); uname(&info);
if (virStrcpyStatic(nodeinfo->model, info.machine) == NULL) if (virStrcpyStatic(nodeinfo->model, info.machine) == NULL)
return -1; return -1;
}
#endif /* !HAVE_UNAME */
#ifdef __linux__ #ifdef __linux__
{ {