prepare the 0.3 release
[lttngtop.git] / src / common.c
index 456e0a5c2086c029741a2b6693cf8b770b96253e..a6c2e4c3cfa17a24d833dce601947e14761969a1 100644 (file)
@@ -298,7 +298,7 @@ struct processtop *get_proc_pid(struct lttngtop *ctx, int tid, int pid,
        tmp = find_process_tid(ctx, tid, NULL);
        if (tmp && tmp->pid == pid)
                return tmp;
-       return add_proc(ctx, tid, "Unknown", timestamp, hostname);
+       return add_proc(ctx, tid, NULL, timestamp, hostname);
 }
 
 void add_thread(struct processtop *parent, struct processtop *thread)
@@ -502,7 +502,10 @@ struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end)
 
                        if (tmpfile != NULL) {
                                memcpy(newfile, tmpfile, sizeof(struct files));
-                               newfile->name = strdup(tmpfile->name);
+                               if (tmpfile->name)
+                                       newfile->name = strdup(tmpfile->name);
+                               else
+                                       newfile->name = NULL;
                                newfile->ref = new;
                                g_ptr_array_add(new->process_files_table,
                                                newfile);
@@ -590,7 +593,7 @@ enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data,
        struct processtop *proc;
        unsigned long timestamp;
        int64_t pid, tid, ppid, vtid, vpid, vppid;
-       char *procname, *hostname = NULL;
+       char *procname = NULL, *hostname = NULL;
 
        timestamp = bt_ctf_get_timestamp(call_data);
        if (timestamp == -1ULL)
@@ -758,3 +761,26 @@ void update_hostname_filter(struct host *host)
                }
        }
 }
+
+char *lookup_procname(const char *procname)
+{
+       if (!procname || !global_procname_list)
+               return NULL;
+
+       return g_hash_table_lookup(global_procname_list, (gpointer) procname);
+}
+
+char *add_procname_list(char *procname, int filter)
+{
+       char *proc;
+
+       proc = lookup_procname(procname);
+       if (proc)
+               return proc;
+
+       proc = strdup(procname);
+       g_hash_table_insert(global_procname_list,
+                       (gpointer) procname, (gpointer) procname);
+
+       return proc;
+}
This page took 0.022528 seconds and 4 git commands to generate.