Use xenstore.h when xen >= 4.2

This commit is contained in:
Davíð Steinn Geirsson 2014-04-21 01:14:32 +00:00 committed by Marek Marczykowski-Górecki
parent b4751c55dc
commit bc75b6559b
4 changed files with 20 additions and 0 deletions

View File

@ -1,6 +1,12 @@
CC=gcc CC=gcc
CFLAGS=-Wall -Wextra -Werror -g -O3 CFLAGS=-Wall -Wextra -Werror -g -O3
all: meminfo-writer all: meminfo-writer
_XENSTORE_H=$(shell ls /usr/include/xenstore.h)
ifneq "$(_XENSTORE_H)" ""
CFLAGS+= -DUSE_XENSTORE_H
endif
meminfo-writer: meminfo-writer.o meminfo-writer: meminfo-writer.o
$(CC) -g -o meminfo-writer meminfo-writer.o -lxenstore $(CC) -g -o meminfo-writer meminfo-writer.o -lxenstore
install: install:

View File

@ -2,7 +2,11 @@
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef USE_XENSTORE_H /* Xen >= 4.2 */
#include <xenstore.h>
#else
#include <xs.h> #include <xs.h>
#endif
#include <syslog.h> #include <syslog.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>

View File

@ -5,6 +5,12 @@ COMMONIOALL=ioall.o
SO_VER=1 SO_VER=1
LDFLAGS=-shared LDFLAGS=-shared
_XENSTORE_H=$(shell ls /usr/include/xenstore.h)
ifneq "$(_XENSTORE_H)" ""
CFLAGS+= -DUSE_XENSTORE_H
endif
all: libqrexec-utils.so.$(SO_VER) libqubes-rpc-filecopy.so.$(SO_VER) all: libqrexec-utils.so.$(SO_VER) libqubes-rpc-filecopy.so.$(SO_VER)
libqrexec-utils.so.$(SO_VER): unix-server.o ioall.o buffer.o write-stdin.o exec.o txrx-vchan.o libqrexec-utils.so.$(SO_VER): unix-server.o ioall.o buffer.o write-stdin.o exec.o txrx-vchan.o
$(CC) $(LDFLAGS) -Wl,-soname,$@ -o $@ $^ $(XENLIBS) $(CC) $(LDFLAGS) -Wl,-soname,$@ -o $@ $^ $(XENLIBS)

View File

@ -24,7 +24,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <libvchan.h> #include <libvchan.h>
#ifdef USE_XENSTORE_H
#include <xenstore.h>
#else
#include <xs.h> #include <xs.h>
#endif
#include <xenctrl.h> #include <xenctrl.h>
static struct libvchan *ctrl; static struct libvchan *ctrl;