Use this to construct the fully-qualified path to xenconsole.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
^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$
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
%.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 $< $@
.PHONY: clean
clean:
- $(RM) -f *.o *.so* *.a $(CLIENTS) $(DEPS)
+ $(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
# $(RM) -f $(AUTOSRCS) $(AUTOINCS)
distclean: clean
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;
}
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
--- /dev/null
+/*
+ * 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;
+}
+