summaryrefslogtreecommitdiffstats
path: root/daemon/debug.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-09-01 15:37:24 +0100
committerRichard Jones <rjones@redhat.com>2010-09-01 15:37:24 +0100
commit83f381f5ccfb7e86bfaaeeade9d06c9e54ddb0cf (patch)
tree30598ae8ae9b8b58f2424075adeafa7c8963520b /daemon/debug.c
parent867319ec5f9030d3c14c32e3302606f2bf11ac27 (diff)
downloadlibguestfs-83f381f5ccfb7e86bfaaeeade9d06c9e54ddb0cf.tar.gz
libguestfs-83f381f5ccfb7e86bfaaeeade9d06c9e54ddb0cf.tar.xz
libguestfs-83f381f5ccfb7e86bfaaeeade9d06c9e54ddb0cf.zip
daemon: Enable debug command by default.
The debug command is useful for internal testing, and so should be enabled by default in all builds. Note that it is still *not* part of the stable ABI.
Diffstat (limited to 'daemon/debug.c')
-rw-r--r--daemon/debug.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/daemon/debug.c b/daemon/debug.c
index c0d87da9..c9a5d8b0 100644
--- a/daemon/debug.c
+++ b/daemon/debug.c
@@ -38,9 +38,13 @@
* to find out what you can do.
*
* Commands always output a freeform string.
+ *
+ * Since libguestfs 1.5.7, the debug command has been enabled
+ * by default for all builds (previously you had to enable it
+ * in configure). This command is not part of the stable ABI
+ * and may change at any time.
*/
-#if ENABLE_DEBUG_COMMAND
struct cmd {
const char *cmd;
char * (*f) (const char *subcmd, int argc, char *const *const argv);
@@ -66,18 +70,10 @@ static struct cmd cmds[] = {
{ "sh", debug_sh },
{ NULL, NULL }
};
-#endif
-
-#if ! ENABLE_DEBUG_COMMAND
-# define MAYBE_UNUSED ATTRIBUTE_UNUSED
-#else
-# define MAYBE_UNUSED /* empty */
-#endif
char *
-do_debug (const char *subcmd MAYBE_UNUSED, char *const *argv MAYBE_UNUSED)
+do_debug (const char *subcmd, char *const *argv)
{
-#if ENABLE_DEBUG_COMMAND
int argc, i;
for (i = argc = 0; argv[i] != NULL; ++i)
@@ -90,13 +86,8 @@ do_debug (const char *subcmd MAYBE_UNUSED, char *const *argv MAYBE_UNUSED)
reply_with_error ("use 'debug help' to list the supported commands");
return NULL;
-#else
- reply_with_error ("guestfsd was not configured with --enable-debug-command");
- return NULL;
-#endif
}
-#if ENABLE_DEBUG_COMMAND
static char *
debug_help (const char *subcmd, int argc, char *const *const argv)
{
@@ -391,22 +382,17 @@ debug_core_pattern (const char *subcmd, int argc, char *const *const argv)
return ret;
}
-#endif /* ENABLE_DEBUG_COMMAND */
-
-#if ENABLE_DEBUG_COMMAND
static int
write_cb (void *fd_ptr, const void *buf, size_t len)
{
int fd = *(int *)fd_ptr;
return xwrite (fd, buf, len);
}
-#endif
/* Has one FileIn parameter. */
int
-do_debug_upload (const char *filename MAYBE_UNUSED, int mode MAYBE_UNUSED)
+do_debug_upload (const char *filename, int mode)
{
-#if ENABLE_DEBUG_COMMAND
/* Not chrooted - this command lets you upload a file to anywhere
* in the appliance.
*/
@@ -445,8 +431,4 @@ do_debug_upload (const char *filename MAYBE_UNUSED, int mode MAYBE_UNUSED)
}
return 0;
-#else
- reply_with_error ("guestfsd was not configured with --enable-debug-command");
- return NULL;
-#endif
}