提交 5349cf1e 编写于 作者: E Eric Blake

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.
上级 9017b9bc
...@@ -59,6 +59,7 @@ strtok_r ...@@ -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
......
...@@ -106,7 +106,7 @@ dnl Use --disable-largefile if you don't want this. ...@@ -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]) ...@@ -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?
......
...@@ -29,16 +29,13 @@ ...@@ -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, ...@@ -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__
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册