[gvfs] daemon: Print client pid in debug output



commit d99161de0e40ef879547d56f4a062eae6e81f4f1
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Feb 13 19:05:14 2017 +0100

    daemon: Print client pid in debug output
    
    It is pretty difficult to get client pid currently when debugging.
    Let's print them from invocation handler.

 daemon/gvfsbackend.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackend.c b/daemon/gvfsbackend.c
index 711c533..e22659a 100644
--- a/daemon/gvfsbackend.c
+++ b/daemon/gvfsbackend.c
@@ -606,9 +606,16 @@ g_vfs_backend_invocation_first_handler (GVfsDBusMount *object,
                                         GDBusMethodInvocation *invocation,
                                         GVfsBackend *backend)
 {
-  g_debug ("backend_dbus_handler %s:%s\n",
+  GDBusConnection *connection;
+  GCredentials *credentials;
+
+  connection = g_dbus_method_invocation_get_connection (invocation);
+  credentials = g_dbus_connection_get_peer_credentials (connection);
+
+  g_debug ("backend_dbus_handler %s:%s (pid=%u)\n",
            g_dbus_method_invocation_get_interface_name (invocation),
-           g_dbus_method_invocation_get_method_name (invocation));
+           g_dbus_method_invocation_get_method_name (invocation),
+           g_credentials_get_unix_pid (credentials, NULL));
 
   if (backend->priv->block_requests)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]