diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2014-11-05 23:17:52 +0000 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2016-01-18 20:46:10 +0100 |
commit | 80cc3a7d353bc9faa85041124e4160ae7b7a50a7 (patch) | |
tree | 38141d2cd27cd317cd15509fb3f69ce2ed1c66d8 | |
parent | 35f4e5dccb6aaa818a53bb6b12acb1c1a2f3b465 (diff) | |
download | gvfs-80cc3a7d353bc9faa85041124e4160ae7b7a50a7.tar.gz |
daemon: Allow controlling debug output from main daemon
Allow controlling whether backends spawned from the main daemon start
with debug output enabled by adding a --debug command-line parameter and
responding to the SIGUSR2 signal. Note that sending SIGUSR2 to the main
daemon does not affect any already spawned backends.
E.g. to capture the login debugging from the sftp backend without having
to restart the main daemon:
$ pkill -x -USR2 gvfsd
$ gvfs-mount sftp://...
$ journalctl -n 40
If --debug is given on the command-line, debug output is enabled for
spawned daemons by default. Sending SIGUSR2 will then turn it off.
https://bugzilla.gnome.org/show_bug.cgi?id=740660
-rw-r--r-- | daemon/main.c | 8 | ||||
-rw-r--r-- | daemon/mount.c | 9 | ||||
-rw-r--r-- | man/gvfsd.xml | 6 |
3 files changed, 22 insertions, 1 deletions
diff --git a/daemon/main.c b/daemon/main.c index bcadc9e7..106119e5 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -28,6 +28,7 @@ #include "gvfsdaemon.h" #include "gvfsbackendtest.h" #include <gvfsdaemonprotocol.h> +#include <gvfsutils.h> #include "mount.h" #include <locale.h> @@ -139,6 +140,7 @@ main (int argc, char *argv[]) GVfsDaemon *daemon; gboolean replace; gboolean no_fuse; + gboolean debugging; gboolean show_version; GError *error; guint name_owner_id; @@ -147,6 +149,7 @@ main (int argc, char *argv[]) const GOptionEntry options[] = { { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, N_("Replace old daemon."), NULL }, { "no-fuse", 0, 0, G_OPTION_ARG_NONE, &no_fuse, N_("Don't start fuse."), NULL }, + { "debug", 'd', 0, G_OPTION_ARG_NONE, &debugging, N_("Enable debug output."), NULL }, { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Show program version."), NULL}, { NULL } }; @@ -157,6 +160,8 @@ main (int argc, char *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); + gvfs_setup_debug_handler (); + #ifdef SIGPIPE signal (SIGPIPE, SIG_IGN); #endif @@ -170,6 +175,7 @@ main (int argc, char *argv[]) replace = FALSE; no_fuse = FALSE; + debugging = FALSE; show_version = FALSE; if (g_getenv ("GVFS_DISABLE_FUSE") != NULL) @@ -192,6 +198,8 @@ main (int argc, char *argv[]) g_option_context_free (context); + gvfs_set_debug (debugging); + if (show_version) { g_print (PACKAGE_STRING "\n"); diff --git a/daemon/mount.c b/daemon/mount.c index 9d8fb00c..e10e1456 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -33,6 +33,7 @@ #include "gmountoperationdbus.h" #include "gvfsdaemonprotocol.h" #include <gvfsdbus.h> +#include <gvfsutils.h> typedef struct { char *display_name; @@ -439,7 +440,13 @@ spawn_mount (MountData *data) return; } - exec = g_strconcat (data->mountable->exec, " --spawner ", g_dbus_connection_get_unique_name (connection), " ", data->obj_path, NULL); + exec = g_strconcat (data->mountable->exec, + gvfs_get_debug () ? " --debug" : "", + " --spawner ", + g_dbus_connection_get_unique_name (connection), + " ", + data->obj_path, + NULL); if (!g_spawn_command_line_async (exec, &error)) { g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (data->spawner)); diff --git a/man/gvfsd.xml b/man/gvfsd.xml index f257eeb0..6b678a52 100644 --- a/man/gvfsd.xml +++ b/man/gvfsd.xml @@ -92,6 +92,12 @@ <listitem><para>Don't start the fuse filesystem.</para></listitem> </varlistentry> + <varlistentry> + <term><option>-d</option>, <option>--debug</option></term> + + <listitem><para>Enable debug output.</para></listitem> + </varlistentry> + </variablelist> </refsect1> |