sysprofd: fix error path and add some logging

This commit is contained in:
Christian Hergert
2019-05-08 21:36:17 -07:00
parent bc5c243407
commit 4a6f7324c1

View File

@ -51,6 +51,8 @@ ipc_service_impl_handle_list_processes (IpcService *service,
g_assert (IPC_IS_SERVICE_IMPL (service));
g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation));
g_message ("ListProcesses()");
if (!(dir = g_dir_open ("/proc/", 0, NULL)))
{
g_dbus_method_invocation_return_error (g_steal_pointer (&invocation),
@ -99,6 +101,8 @@ ipc_service_impl_handle_get_proc_file (IpcService *service,
g_assert (IPC_IS_SERVICE_IMPL (service));
g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation));
g_message ("GetProcFile(%s)", path);
canon = g_canonicalize_filename (path, "/proc/");
if (!g_str_has_prefix (canon, "/proc/"))
@ -168,6 +172,8 @@ ipc_service_impl_handle_perf_event_open (IpcService *service,
g_assert (IPC_IS_SERVICE_IMPL (service));
g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation));
g_message ("PerfEventOpen(pid=%d, cpu=%d)", pid, cpu);
if (pid < -1 || cpu < -1)
{
g_dbus_method_invocation_return_error (g_steal_pointer (&invocation),
@ -307,6 +313,7 @@ ipc_service_impl_handle_perf_event_open (IpcService *service,
G_DBUS_ERROR_FAILED,
"Failed to open perf event stream: %s",
g_strerror (errno));
return TRUE;
}
fd_list = g_unix_fd_list_new ();