mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Fri Dec 7 14:36:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* src/.cvsignore: Ignore *.loT files (generated under Windows). * proxy/libvirt_proxy.c: Bail out earlier --without-xen. * src/proxy_internal.c: Don't build proxy client side if configured --without-xen. * src/iptables.c, src/iptables.h: Disable this code if configured --without-qemu. * src/nodeinfo.c: If no 'uname' function, set model name to empty string (for Windows). * src/xen_unified.h, src/util.c, src/test.c: Include <winsock2.h> on Windows. * src/util.c: Disable virExec* and virFileLinkPointsTo on MinGW.
This commit is contained in:
parent
36f0ce0472
commit
f1f94721ae
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Fri Dec 7 14:36:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
|
||||||
|
* src/.cvsignore: Ignore *.loT files (generated under Windows).
|
||||||
|
* proxy/libvirt_proxy.c: Bail out earlier --without-xen.
|
||||||
|
* src/proxy_internal.c: Don't build proxy client side if
|
||||||
|
configured --without-xen.
|
||||||
|
* src/iptables.c, src/iptables.h: Disable this code if
|
||||||
|
configured --without-qemu.
|
||||||
|
* src/nodeinfo.c: If no 'uname' function, set model name to
|
||||||
|
empty string (for Windows).
|
||||||
|
|
||||||
Fri Dec 7 14:34:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
|
Fri Dec 7 14:34:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
|
||||||
* src/sexpr.c: Cosmetic rearrangement of headers.
|
* src/sexpr.c: Cosmetic rearrangement of headers.
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef WITH_XEN
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -20,9 +22,9 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#ifdef WITH_XEN
|
|
||||||
#include "proxy_internal.h"
|
#include "proxy_internal.h"
|
||||||
#include "xen_internal.h"
|
#include "xen_internal.h"
|
||||||
#include "xend_internal.h"
|
#include "xend_internal.h"
|
||||||
@ -839,10 +841,12 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else /* WITHOUT_XEN */
|
#else /* WITHOUT_XEN */
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
fprintf(stderr, "libvirt was compiled without Xen support\n");
|
fprintf(stderr, "libvirt was compiled without Xen support\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WITH_XEN */
|
#endif /* WITH_XEN */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3,6 +3,7 @@ Makefile.in
|
|||||||
.deps
|
.deps
|
||||||
.libs
|
.libs
|
||||||
*.lo
|
*.lo
|
||||||
|
*.loT
|
||||||
*.la
|
*.la
|
||||||
virsh
|
virsh
|
||||||
*.gcda
|
*.gcda
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
* Mark McLoughlin <markmc@redhat.com>
|
* Mark McLoughlin <markmc@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include "config.h"
|
||||||
|
|
||||||
#include "iptables.h"
|
#if WITH_QEMU
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -31,12 +31,19 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <paths.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_PATHS_H
|
||||||
|
#include <paths.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "iptables.h"
|
||||||
|
|
||||||
#define qemudLog(level, msg...) fprintf(stderr, msg)
|
#define qemudLog(level, msg...) fprintf(stderr, msg)
|
||||||
|
|
||||||
@ -1092,6 +1099,8 @@ iptablesRemoveForwardMasquerade(iptablesContext *ctx,
|
|||||||
return iptablesForwardMasquerade(ctx, network, physdev, REMOVE);
|
return iptablesForwardMasquerade(ctx, network, physdev, REMOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_QEMU */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
* indent-tabs-mode: nil
|
* indent-tabs-mode: nil
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#ifndef __QEMUD_IPTABLES_H__
|
#ifndef __QEMUD_IPTABLES_H__
|
||||||
#define __QEMUD_IPTABLES_H__
|
#define __QEMUD_IPTABLES_H__
|
||||||
|
|
||||||
|
#if WITH_QEMU
|
||||||
|
|
||||||
typedef struct _iptablesContext iptablesContext;
|
typedef struct _iptablesContext iptablesContext;
|
||||||
|
|
||||||
iptablesContext *iptablesContextNew (void);
|
iptablesContext *iptablesContextNew (void);
|
||||||
@ -83,6 +85,8 @@ int iptablesRemoveForwardMasquerade (iptablesContext *ctx,
|
|||||||
const char *network,
|
const char *network,
|
||||||
const char *physdev);
|
const char *physdev);
|
||||||
|
|
||||||
|
#endif /* WITH_QEMU */
|
||||||
|
|
||||||
#endif /* __QEMUD_IPTABLES_H__ */
|
#endif /* __QEMUD_IPTABLES_H__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -26,10 +26,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UTSNAME_H
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nodeinfo.h"
|
#include "nodeinfo.h"
|
||||||
#include "physmem.h"
|
#include "physmem.h"
|
||||||
|
|
||||||
@ -120,6 +123,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n
|
|||||||
|
|
||||||
int virNodeInfoPopulate(virConnectPtr conn,
|
int virNodeInfoPopulate(virConnectPtr conn,
|
||||||
virNodeInfoPtr nodeinfo) {
|
virNodeInfoPtr nodeinfo) {
|
||||||
|
#ifdef HAVE_UNAME
|
||||||
struct utsname info;
|
struct utsname info;
|
||||||
|
|
||||||
if (uname(&info) < 0) {
|
if (uname(&info) < 0) {
|
||||||
@ -128,10 +132,15 @@ int virNodeInfoPopulate(virConnectPtr conn,
|
|||||||
"cannot extract machine type %s", strerror(errno));
|
"cannot extract machine type %s", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(nodeinfo->model, info.machine, sizeof(nodeinfo->model)-1);
|
strncpy(nodeinfo->model, info.machine, sizeof(nodeinfo->model)-1);
|
||||||
nodeinfo->model[sizeof(nodeinfo->model)-1] = '\0';
|
nodeinfo->model[sizeof(nodeinfo->model)-1] = '\0';
|
||||||
|
|
||||||
|
#else /* !HAVE_UNAME */
|
||||||
|
|
||||||
|
nodeinfo->model[0] = '\0';
|
||||||
|
|
||||||
|
#endif /* !HAVE_UNAME */
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
* Daniel Veillard <veillard@redhat.com>
|
* Daniel Veillard <veillard@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef WITH_XEN
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -1111,6 +1113,8 @@ xenProxyDomainGetOSType(virDomainPtr domain)
|
|||||||
return(ostype);
|
return(ostype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_XEN */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vim: set tabstop=4:
|
* vim: set tabstop=4:
|
||||||
* vim: set shiftwidth=4:
|
* vim: set shiftwidth=4:
|
||||||
|
@ -35,8 +35,14 @@
|
|||||||
#include <libxml/uri.h>
|
#include <libxml/uri.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_WINSOCK2_H
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#else
|
||||||
|
#include <winsock2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
52
src/util.c
52
src/util.c
@ -30,12 +30,15 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <paths.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_PATHS_H
|
||||||
|
#include <paths.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libvirt/virterror.h"
|
#include "libvirt/virterror.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
@ -65,6 +68,8 @@ ReportError(virConnectPtr conn,
|
|||||||
NULL, NULL, NULL, -1, -1, "%s", errorMessage);
|
NULL, NULL, NULL, -1, -1, "%s", errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __MINGW32__
|
||||||
|
|
||||||
static int virSetCloseExec(int fd) {
|
static int virSetCloseExec(int fd) {
|
||||||
int flags;
|
int flags;
|
||||||
if ((flags = fcntl(fd, F_GETFD)) < 0)
|
if ((flags = fcntl(fd, F_GETFD)) < 0)
|
||||||
@ -198,6 +203,34 @@ virExecNonBlock(virConnectPtr conn,
|
|||||||
return(_virExec(conn, argv, retpid, infd, outfd, errfd, 1));
|
return(_virExec(conn, argv, retpid, infd, outfd, errfd, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* __MINGW32__ */
|
||||||
|
|
||||||
|
int
|
||||||
|
virExec(virConnectPtr conn,
|
||||||
|
char **argv ATTRIBUTE_UNUSED,
|
||||||
|
int *retpid ATTRIBUTE_UNUSED,
|
||||||
|
int infd ATTRIBUTE_UNUSED,
|
||||||
|
int *outfd ATTRIBUTE_UNUSED,
|
||||||
|
int *errfd ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
ReportError (conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virExecNonBlock(virConnectPtr conn,
|
||||||
|
char **argv ATTRIBUTE_UNUSED,
|
||||||
|
int *retpid ATTRIBUTE_UNUSED,
|
||||||
|
int infd ATTRIBUTE_UNUSED,
|
||||||
|
int *outfd ATTRIBUTE_UNUSED,
|
||||||
|
int *errfd ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
ReportError (conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __MINGW32__ */
|
||||||
|
|
||||||
/* Like read(), but restarts after EINTR */
|
/* Like read(), but restarts after EINTR */
|
||||||
int saferead(int fd, void *buf, size_t count)
|
int saferead(int fd, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
@ -313,6 +346,7 @@ int virFileHasSuffix(const char *str,
|
|||||||
return strcmp(str + len - suffixlen, suffix) == 0;
|
return strcmp(str + len - suffixlen, suffix) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __MINGW32__
|
||||||
|
|
||||||
int virFileLinkPointsTo(const char *checkLink,
|
int virFileLinkPointsTo(const char *checkLink,
|
||||||
const char *checkDest)
|
const char *checkDest)
|
||||||
@ -397,6 +431,22 @@ int virFileLinkPointsTo(const char *checkLink,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* !__MINGW32__ */
|
||||||
|
|
||||||
|
/* Gnulib has an implementation of readlink which could be used
|
||||||
|
* to implement this, but it requires LGPLv3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
virFileLinkPointsTo (const char *checkLink ATTRIBUTE_UNUSED,
|
||||||
|
const char *checkDest ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
virLog ("%s: not implemented", __FUNCTION__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*! __MINGW32__ */
|
||||||
|
|
||||||
int virFileMakePath(const char *path)
|
int virFileMakePath(const char *path)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -13,8 +13,12 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_WINSOCK2_H
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#else
|
||||||
|
#include <winsock2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
Loading…
Reference in New Issue
Block a user