fi
AM_CONDITIONAL([WITH_LXC], [test "$with_lxc" = "yes"])
+dnl
+dnl check for shell that understands <> redirection without truncation,
+dnl needed by src/qemu/qemu_monitor_{text,json}.c.
+dnl
+if test "$with_qemu" = yes; then
+ lv_wrapper_shell=
+ AC_CACHE_CHECK([for shell that supports <> redirection],
+ [lv_cv_wrapper_shell],
+ [
+ # If cross-compiling, guess that /bin/sh is good enough except for
+ # Linux, where it might be dash 0.5.5 which is known broken; and on
+ # Linux, we have a good chance that /bin/bash will exist.
+ # If we guess wrong, a user can override the cache variable.
+ # Going through /bin/bash is a slight slowdown if /bin/sh works.
+ if test "$cross_compiling" = yes; then
+ case $host_os in
+ linux*) lv_cv_wrapper_shell=/bin/bash ;;
+ *) lv_cv_wrapper_shell=/bin/sh ;;
+ esac
+ else
+ for lv_cv_wrapper_shell in /bin/sh bash ksh zsh none; do
+ test $lv_cv_wrapper_shell = none &&
+ AC_MSG_ERROR([could not find decent shell])
+ echo a > conftest.a
+ $lv_cv_wrapper_shell -c ': 1<>conftest.a'
+ case `cat conftest.a`.$lv_cv_wrapper_shell in
+ a./*) break;; dnl /bin/sh is good enough
+ a.*) dnl bash, ksh, and zsh all understand 'command', use that
+ dnl to determine the absolute path of the shell
+ lv_cv_wrapper_shell=`$lv_cv_wrapper_shell -c \
+ 'command -v $lv_cv_wrapper_shell'`
+ case $lv_cv_wrapper_shell in
+ /*) break;;
+ esac
+ ;;
+ esac
+ done
+ rm -f conftest.a
+ fi
+ ])
+ if test "x$lv_cv_wrapper_shell" != x/bin/sh; then
+ lv_wrapper_shell=$lv_cv_wrapper_shell
+ fi
+ if test "x$lv_wrapper_shell" != x; then
+ AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], [$lv_wrapper_shell],
+ [Define to the absolute path of a shell that does not truncate on
+ <> redirection, if /bin/sh does not fit the bill])
+ fi
+fi
+
dnl
dnl check for kernel headers required by src/bridge.c
int qemuMonitorArbitraryCommand(qemuMonitorPtr mon, const char *cmd, char **reply);
+/**
+ * When running two dd process and using <> redirection, we need a
+ * shell that will not truncate files. These two strings serve that
+ * purpose.
+ */
+# ifdef VIR_WRAPPER_SHELL
+# define VIR_WRAPPER_SHELL_PREFIX VIR_WRAPPER_SHELL " -c '"
+# define VIR_WRAPPER_SHELL_SUFFIX "'"
+# else
+# define VIR_WRAPPER_SHELL_PREFIX /* nothing */
+# define VIR_WRAPPER_SHELL_SUFFIX /* nothing */
+# endif
+
#endif /* QEMU_MONITOR_H */
* allow starting at an alignment of 512, but without wasting
* padding to get to the larger alignment useful for speed. Use
* <> redirection to avoid truncating a regular file. */
- if (virAsprintf(&dest, "exec:%s | { dd bs=%llu seek=%llu if=/dev/null && "
- "dd bs=%llu; } 1<>%s",
+ if (virAsprintf(&dest, "exec:" VIR_WRAPPER_SHELL_PREFIX "%s | "
+ "{ dd bs=%llu seek=%llu if=/dev/null && "
+ "dd bs=%llu; } 1<>%s" VIR_WRAPPER_SHELL_SUFFIX,
argstr, QEMU_MONITOR_MIGRATE_TO_FILE_BS,
offset / QEMU_MONITOR_MIGRATE_TO_FILE_BS,
QEMU_MONITOR_MIGRATE_TO_FILE_TRANSFER_SIZE,
* allow starting at an alignment of 512, but without wasting
* padding to get to the larger alignment useful for speed. Use
* <> redirection to avoid truncating a regular file. */
- if (virAsprintf(&dest, "exec:%s | { dd bs=%llu seek=%llu if=/dev/null && "
- "dd bs=%llu; } 1<>%s",
+ if (virAsprintf(&dest, "exec:" VIR_WRAPPER_SHELL_PREFIX "%s | "
+ "{ dd bs=%llu seek=%llu if=/dev/null && "
+ "dd bs=%llu; } 1<>%s" VIR_WRAPPER_SHELL_SUFFIX,
argstr, QEMU_MONITOR_MIGRATE_TO_FILE_BS,
offset / QEMU_MONITOR_MIGRATE_TO_FILE_BS,
QEMU_MONITOR_MIGRATE_TO_FILE_TRANSFER_SIZE,