aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.hgignore1
-rw-r--r--tools/libxl/Makefile13
-rw-r--r--tools/libxl/libxl.c13
-rw-r--r--tools/libxl/libxl_internal.h11
-rw-r--r--tools/libxl/libxl_paths.c61
5 files changed, 87 insertions, 12 deletions
diff --git a/.hgignore b/.hgignore
index ac47be625d..88d6de0124 100644
--- a/.hgignore
+++ b/.hgignore
@@ -180,6 +180,7 @@
^tools/libxen/libxenapi-
^tools/libxen/test/test_bindings$
^tools/libxen/test/test_event_handling$
+^tools/libxl/_.*\.h$
^tools/libxl/libxlu_cfg_y\.output$
^tools/libxl/xl$
^tools/libaio/src/.*\.ol$
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 75ac02aa47..df2e1fbe3d 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -17,7 +17,7 @@ CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore)
LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
-LIBXL_OBJS-y = osdeps.o
+LIBXL_OBJS-y = osdeps.o libxl_paths.o
LIBXL_OBJS = flexarray.o libxl.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o xenguest.o libxl_utils.o $(LIBXL_OBJS-y)
AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
@@ -43,6 +43,15 @@ $(LIBXLU_OBJS): $(AUTOINCS)
%.c: %.l
$(FLEX) --header-file=$*.h --outfile=$@ $<
+genpath-target = $(call buildmakevars2file,_libxl_paths.h)
+$(eval $(genpath-target))
+
+_libxl_paths.h: genpath
+ sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@ >_$@
+ mv _$@ $@
+
+libxl_paths.c: _libxl_paths.h
+
libxenlight.so: libxenlight.so.$(MAJOR)
ln -sf $< $@
@@ -88,7 +97,7 @@ install: all
.PHONY: clean
clean:
- $(RM) -f *.o *.so* *.a $(CLIENTS) $(DEPS)
+ $(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
# $(RM) -f $(AUTOSRCS) $(AUTOINCS)
distclean: clean
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 1d42f3cf34..620128d155 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -739,16 +739,9 @@ int libxl_domain_destroy(struct libxl_ctx *ctx, uint32_t domid, int force)
int libxl_console_attach(struct libxl_ctx *ctx, uint32_t domid, int cons_num)
{
- struct stat st;
- const char *XENCONSOLE = "/usr/lib/xen/bin/xenconsole";
- char *cmd;
-
- if (stat(XENCONSOLE, &st) != 0) {
- XL_LOG(ctx, XL_LOG_ERROR, "could not access %s", XENCONSOLE);
- return ERROR_FAIL;
- }
-
- cmd = libxl_sprintf(ctx, "%s %d --num %d", XENCONSOLE, domid, cons_num);
+ char *cmd = libxl_sprintf(
+ ctx, "%s/xenconsole %d --num %d",
+ libxl_private_bindir_path(), domid, cons_num);
return (system(cmd) != 0) ? ERROR_FAIL : 0;
}
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 0dc48f1f08..3bcae165a8 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -202,5 +202,16 @@ void libxl_exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args
void libxl_log_child_exitstatus(struct libxl_ctx *ctx,
const char *what, pid_t pid, int status);
+/* libxl_paths.c */
+const char *libxl_sbindir_path(void);
+const char *libxl_bindir_path(void);
+const char *libxl_libexec_path(void);
+const char *libxl_libdir_path(void);
+const char *libxl_sharedir_path(void);
+const char *libxl_private_bindir_path(void);
+const char *libxl_xenfirmwaredir_path(void);
+const char *libxl_xen_config_dir_path(void);
+const char *libxl_xen_script_dir_path(void);
+
#endif
diff --git a/tools/libxl/libxl_paths.c b/tools/libxl/libxl_paths.c
new file mode 100644
index 0000000000..ceb1d73265
--- /dev/null
+++ b/tools/libxl/libxl_paths.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 Citrix Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "_libxl_paths.h"
+
+const char *libxl_sbindir_path(void)
+{
+ return SBINDIR;
+}
+
+const char *libxl_bindir_path(void)
+{
+ return BINDIR;
+}
+
+const char *libxl_libexec_path(void)
+{
+ return LIBEXEC;
+}
+
+const char *libxl_libdir_path(void)
+{
+ return LIBDIR;
+}
+
+const char *libxl_sharedir_path(void)
+{
+ return SHAREDIR;
+}
+
+const char *libxl_private_bindir_path(void)
+{
+ return PRIVATE_BINDIR;
+}
+
+const char *libxl_xenfirmwaredir_path(void)
+{
+ return XENFIRMWAREDIR;
+}
+
+const char *libxl_xen_config_dir_path(void)
+{
+ return XEN_CONFIG_DIR;
+}
+
+const char *libxl_xen_script_dir_path(void)
+{
+ return XEN_SCRIPT_DIR;
+}
+