[sysprof/wip/chergert/sysprof-3] libsysprof: remove dead code



commit 9fcab4f7eb1a817296a60f66c9b2511b0ec45f9c
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 10 21:14:45 2019 -0700

    libsysprof: remove dead code

 src/libsysprof/sysprof-proc-source.c        | 49 -----------------------------
 src/libsysprof/sysprof-proc-source.h        |  3 --
 src/libsysprof/sysprof-process-model-item.c | 20 ------------
 src/libsysprof/sysprof-process-model-item.h |  2 --
 4 files changed, 74 deletions(-)
---
diff --git a/src/libsysprof/sysprof-proc-source.c b/src/libsysprof/sysprof-proc-source.c
index e5823a5..78143b8 100644
--- a/src/libsysprof/sysprof-proc-source.c
+++ b/src/libsysprof/sysprof-proc-source.c
@@ -83,55 +83,6 @@ proc_readlines (const gchar *format,
   return g_steal_pointer (&ret);
 }
 
-gchar *
-sysprof_proc_source_get_command_line (GPid      pid,
-                                      gboolean *is_kernel)
-{
-  gchar *ret;
-  gchar **lines;
-
-  if (is_kernel)
-    *is_kernel = FALSE;
-
-  /*
-   * Get the full command line from /proc/pid/cmdline.
-   */
-  if (NULL != (lines = proc_readlines ("/proc/%d/cmdline", pid)))
-    {
-      if (lines [0] && lines [0][0])
-        {
-          ret = g_strdup (lines [0]);
-          g_strfreev (lines);
-          return ret;
-        }
-
-      g_strfreev (lines);
-    }
-
-  /*
-   * We are guessing this is a kernel process based on cmdline being null.
-   */
-  if (is_kernel)
-    *is_kernel = TRUE;
-
-  /*
-   * Check the first line of /proc/pid/status for Name: foo
-   */
-  if (NULL != (lines = proc_readlines ("/proc/%d/status", pid)))
-    {
-      if (lines [0] && g_str_has_prefix (lines [0], "Name:"))
-        {
-          ret = g_strstrip (g_strdup (lines [0] + 5));
-          g_strfreev (lines);
-          return ret;
-        }
-
-      g_strfreev (lines);
-    }
-
-  return NULL;
-}
-
 static void
 sysprof_proc_source_populate_process (SysprofProcSource *self,
                                       GPid               pid,
diff --git a/src/libsysprof/sysprof-proc-source.h b/src/libsysprof/sysprof-proc-source.h
index 693769c..f379367 100644
--- a/src/libsysprof/sysprof-proc-source.h
+++ b/src/libsysprof/sysprof-proc-source.h
@@ -37,8 +37,5 @@ G_DECLARE_FINAL_TYPE (SysprofProcSource, sysprof_proc_source, SYSPROF, PROC_SOUR
 
 SYSPROF_AVAILABLE_IN_ALL
 SysprofSource *sysprof_proc_source_new              (void);
-SYSPROF_AVAILABLE_IN_ALL
-gchar         *sysprof_proc_source_get_command_line (GPid      pid,
-                                                     gboolean *is_kernel);
 
 G_END_DECLS
diff --git a/src/libsysprof/sysprof-process-model-item.c b/src/libsysprof/sysprof-process-model-item.c
index bdad212..c46b3c4 100644
--- a/src/libsysprof/sysprof-process-model-item.c
+++ b/src/libsysprof/sysprof-process-model-item.c
@@ -172,26 +172,6 @@ sysprof_process_model_item_new_from_variant (GVariant *info)
   return g_steal_pointer (&ret);
 }
 
-SysprofProcessModelItem *
-sysprof_process_model_item_new (GPid pid)
-{
-  g_autofree gchar *cmdline = NULL;
-  SysprofProcessModelItem *ret;
-  gboolean is_kernel = FALSE;
-
-#ifdef __linux__
-  cmdline = sysprof_proc_source_get_command_line (pid, &is_kernel);
-#endif
-
-  ret = g_object_new (SYSPROF_TYPE_PROCESS_MODEL_ITEM,
-                      "command-line", cmdline,
-                      "pid", (int)pid,
-                      NULL);
-  ret->is_kernel = is_kernel;
-
-  return ret;
-}
-
 guint
 sysprof_process_model_item_hash (SysprofProcessModelItem *self)
 {
diff --git a/src/libsysprof/sysprof-process-model-item.h b/src/libsysprof/sysprof-process-model-item.h
index bfff6bb..2b22ec4 100644
--- a/src/libsysprof/sysprof-process-model-item.h
+++ b/src/libsysprof/sysprof-process-model-item.h
@@ -35,8 +35,6 @@ G_BEGIN_DECLS
 SYSPROF_AVAILABLE_IN_ALL
 G_DECLARE_FINAL_TYPE (SysprofProcessModelItem, sysprof_process_model_item, SYSPROF, PROCESS_MODEL_ITEM, 
GObject)
 
-SYSPROF_AVAILABLE_IN_ALL
-SysprofProcessModelItem *sysprof_process_model_item_new              (GPid                     pid);
 SYSPROF_AVAILABLE_IN_ALL
 SysprofProcessModelItem *sysprof_process_model_item_new_from_variant (GVariant                *info);
 SYSPROF_AVAILABLE_IN_ALL


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