tools/flask/utils/flask-label-pci
tools/hotplug/common/hotplugpath.sh
tools/hotplug/FreeBSD/rc.d/xencommons
+tools/hotplug/FreeBSD/rc.d/xendriverdomain
tools/hotplug/Linux/init.d/sysconfig.xencommons
tools/hotplug/Linux/init.d/xen-watchdog
tools/hotplug/Linux/init.d/xencommons
tools/hotplug/Linux/init.d/xendomains
+tools/hotplug/Linux/init.d/xendriverdomain
tools/hotplug/Linux/systemd/*.conf
tools/hotplug/Linux/systemd/*.mount
tools/hotplug/Linux/systemd/*.socket
tools/hotplug/Linux/xen-hotplug-common.sh
tools/hotplug/Linux/xendomains
tools/hotplug/NetBSD/rc.d/xencommons
+tools/hotplug/NetBSD/rc.d/xendriverdomain
tools/include/xen/*
tools/include/xen-xsm/*
tools/include/xen-foreign/*.(c|h|size)
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons libxl/xenlight.pc.in libxl/xlutil.pc.in"
+ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in"
ac_config_headers="$ac_config_headers config.h"
case $ac_config_target in
"../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;;
"hotplug/FreeBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xencommons" ;;
+ "hotplug/FreeBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xendriverdomain" ;;
"hotplug/Linux/init.d/sysconfig.xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/sysconfig.xencommons" ;;
"hotplug/Linux/init.d/xen-watchdog") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xen-watchdog" ;;
"hotplug/Linux/init.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xencommons" ;;
"hotplug/Linux/init.d/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xendomains" ;;
+ "hotplug/Linux/init.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xendriverdomain" ;;
"hotplug/Linux/vif-setup") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/vif-setup" ;;
"hotplug/Linux/xen-hotplug-common.sh") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xen-hotplug-common.sh" ;;
"hotplug/Linux/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xendomains" ;;
"hotplug/NetBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xencommons" ;;
+ "hotplug/NetBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xendriverdomain" ;;
"libxl/xenlight.pc.in") CONFIG_FILES="$CONFIG_FILES libxl/xenlight.pc.in" ;;
"libxl/xlutil.pc.in") CONFIG_FILES="$CONFIG_FILES libxl/xlutil.pc.in" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
AC_CONFIG_FILES([
../config/Tools.mk
hotplug/FreeBSD/rc.d/xencommons
+hotplug/FreeBSD/rc.d/xendriverdomain
hotplug/Linux/init.d/sysconfig.xencommons
hotplug/Linux/init.d/xen-watchdog
hotplug/Linux/init.d/xencommons
hotplug/Linux/init.d/xendomains
+hotplug/Linux/init.d/xendriverdomain
hotplug/Linux/vif-setup
hotplug/Linux/xen-hotplug-common.sh
hotplug/Linux/xendomains
hotplug/NetBSD/rc.d/xencommons
+hotplug/NetBSD/rc.d/xendriverdomain
libxl/xenlight.pc.in
libxl/xlutil.pc.in
])
XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons
+XEN_RCD_PROG = rc.d/xencommons rc.d/xendriverdomain
.PHONY: all
all:
--- /dev/null
+#!/bin/sh
+#
+# PROVIDE: xendriverdomain
+# REQUIRE: DAEMON
+#
+# Should be run in a driver domain, but not in domain 0.
+
+. /etc/rc.subr
+
+. /etc/xen/scripts/hotplugpath.sh
+
+LD_LIBRARY_PATH="${libdir}"
+export LD_LIBRARY_PATH
+
+name="xendriverdomain"
+start_precmd="xendriverdomain_precmd"
+start_cmd="xendriverdomain_startcmd"
+stop_cmd="xendriverdomain_stop"
+extra_commands=""
+
+XLDEVD_PIDFILE="/var/run/xldevd.pid"
+
+xendriverdomain_precmd()
+{
+ :
+}
+
+xendriverdomain_startcmd()
+{
+ printf "Starting xenservices: xl devd."
+
+ ${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE ${XLDEVD_ARGS}
+
+ printf "\n"
+}
+
+xendriverdomain_stop()
+{
+ printf "Stopping xl devd.\n"
+
+ rc_pid=$(check_pidfile ${XLDEVD_PIDFILE} ${sbindir}/xl)
+
+ kill -${sig_stop:-TERM} $rc_pids
+ wait_for_pids $rc_pids
+}
+
+load_rc_config $name
+run_rc_command "$1"
XENCOMMONS_INITD = init.d/xencommons
XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons
+XENDRIVERDOMAIN_INITD = init.d/xendriverdomain
+
# Xen script dir and scripts to go there.
XEN_SCRIPTS = vif-bridge
XEN_SCRIPTS += vif-route
$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
$(INSTALL_DATA) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
+ $(INSTALL_PROG) $(XENDRIVERDOMAIN_INITD) $(DESTDIR)$(INITD_DIR)
$(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
.PHONY: install-scripts
--- /dev/null
+
+#!/bin/bash
+#
+# xendriverdomain Script to start services needed in a Xen driver domain
+#
+# NOTE: This initscript is not needed on dom0.
+
+# chkconfig: 2345 70 10
+# description: Starts and stops xen driver domain daemon
+### BEGIN INIT INFO
+# Provides: xendevd
+# Required-Start: $syslog $remote_fs
+# Should-Start:
+# Required-Stop: $syslog $remote_fs
+# Should-Stop:
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Start/stop xen driver domain daemon
+# Description: Starts and stops the daemons neeeded for a xen driver domain
+### END INIT INFO
+
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
+
+xendriverdomain_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@
+
+test -f $xendriverdomain_config/xendriverdomain && . $xendriverdomain_config/xendriverdomain
+
+XLDEVD_PIDFILE=/var/run/xldevd.pid
+
+# not running in Xen dom0 or domU
+if ! test -d /proc/xen ; then
+ exit 0
+fi
+
+# mount xenfs in dom0 or domU with a pv_ops kernel
+if test "x$1" = xstart && \
+ ! test -f /proc/xen/capabilities && \
+ ! grep '^xenfs ' /proc/mounts >/dev/null;
+then
+ mount -t xenfs xenfs /proc/xen
+fi
+
+# run this script only in domU:
+# no capabilities file in xenlinux domU kernel
+# empty capabilities file in pv_ops domU kernel
+if ! test -f /proc/xen/capabilities || \
+ grep -q "control_d" /proc/xen/capabilities ; then
+ exit 0
+fi
+
+do_start () {
+ echo Starting xl devd...
+ ${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE $XLDEVD_ARGS
+}
+do_stop () {
+ echo Stopping xl devd...
+ if read 2>/dev/null <$XLDEVD_PIDFILE pid; then
+ kill $pid
+ while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+ rm -f $XLDEVD_PIDFILE
+ fi
+}
+
+case "$1" in
+ start)
+ do_start
+ ;;
+ stop)
+ do_stop
+ ;;
+ reload)
+ echo >&2 'Reload not available; use force-reload'; exit 1
+ ;;
+ force-reload|restart)
+ do_stop
+ do_start
+ ;;
+ *)
+ # do not advertise unreasonable commands that there is no reason
+ # to use with this device
+ echo $"Usage: $0 {start|stop|restart|force-reload}"
+ exit 1
+esac
+
+exit $?
XEN_SCRIPTS += vif-ip
XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog
+XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
.PHONY: all
all:
--- /dev/null
+#!/bin/sh
+#
+# PROVIDE: xendriverdomain
+# REQUIRE: DAEMON
+#
+# Should be run in a driver domain, but not in domain 0.
+
+. /etc/rc.subr
+
+DIR=$(dirname "$0")
+. "${DIR}/xen-hotplugpath.sh"
+
+LD_LIBRARY_PATH="${libdir}"
+export LD_LIBRARY_PATH
+
+name="xendriverdomain"
+start_precmd="xendriverdomain_precmd"
+start_cmd="xendriverdomain_startcmd"
+stop_cmd="xendriverdomain_stop"
+extra_commands=""
+
+XLDEVD_PIDFILE="/var/run/xldevd.pid"
+
+xendriverdomain_precmd()
+{
+ :
+}
+
+xendriverdomain_startcmd()
+{
+ printf "Starting xenservices: xl devd."
+
+ ${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE ${XLDEVD_ARGS}
+
+ printf "\n"
+}
+
+xendriverdomain_stop()
+{
+ printf "Stopping xl devd.\n"
+
+ rc_pid=$(check_pidfile ${XLDEVD_PIDFILE} ${sbindir}/xl)
+
+ kill -${sig_stop:-TERM} $rc_pids
+ wait_for_pids $rc_pids
+}
+
+load_rc_config $name
+run_rc_command "$1"
flush_stream(fh);
}
-static int do_daemonize(char *name)
+static int do_daemonize(char *name, const char *pidfile)
{
char *fullname;
pid_t child1;
CHK_SYSCALL(daemon(0, 1));
+ if (pidfile) {
+ int fd = open(pidfile, O_RDWR | O_CREAT, S_IRUSR|S_IWUSR);
+ char *pid = NULL;
+
+ if (fd == -1) {
+ perror("Unable to open pidfile");
+ exit(1);
+ }
+
+ if (asprintf(&pid, "%ld\n", (long)getpid()) == -1) {
+ perror("Formatting pid");
+ exit(1);
+ }
+
+ if (write(fd, pid, strlen(pid)) < 0) {
+ perror("Writing pid");
+ exit(1);
+ }
+
+ if ( close(fd) < 0 ) {
+ perror("Closing pidfile");
+ exit(1);
+ }
+ }
+
out:
return ret;
}
char *name;
xasprintf(&name, "xl-%s", d_config.c_info.name);
- ret = do_daemonize(name);
+ ret = do_daemonize(name, NULL);
free(name);
if (ret) {
ret = (ret == 1) ? domid : ret;
int main_devd(int argc, char **argv)
{
int ret = 0, opt = 0, daemonize = 1;
+ const char *pidfile = NULL;
+ static const struct option opts[] = {
+ {"pidfile", 1, 0, 'p'},
+ COMMON_LONG_OPTS,
+ {0, 0, 0, 0}
+ };
- SWITCH_FOREACH_OPT(opt, "F", NULL, "devd", 0) {
+ SWITCH_FOREACH_OPT(opt, "Fp:", opts, "devd", 0) {
case 'F':
daemonize = 0;
break;
+ case 'p':
+ pidfile = optarg;
+ break;
}
if (daemonize) {
- ret = do_daemonize("xldevd");
+ ret = do_daemonize("xldevd", pidfile);
if (ret) {
ret = (ret == 1) ? 0 : ret;
goto out;
&main_devd, 0, 1,
"Daemon that listens for devices and launches backends",
"[options]",
- "-F Run in the foreground",
+ "-F Run in the foreground.\n"
+ "-p, --pidfile [FILE] Write PID to pidfile when daemonizing.",
},
#ifdef LIBXL_HAVE_PSR_CMT
{ "psr-hwinfo",