X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon.c;h=3d8fc4040880c9a4f4dfc95031eae7dc7bd28c74;hb=114cae592abf524003c3575623dbdb2191a827cc;hp=021f2f1217b2316bd383e1a1ec146df492b70fd4;hpb=1d2391b4818d470a92437e77892b0c5d7c10a466;p=lttngtop.git diff --git a/src/common.c b/src/common.c index 021f2f1..3d8fc40 100644 --- a/src/common.c +++ b/src/common.c @@ -212,7 +212,7 @@ struct processtop* add_proc(struct lttngtop *ctx, int tid, char *comm, free(newproc->hostname); } newproc->hostname = strdup(hostname); - if (lookup_hostname_list(hostname)) { + if (is_hostname_filtered(hostname)) { add_filter_tid_list(tid, newproc); } } @@ -236,7 +236,7 @@ struct processtop* update_proc(struct processtop* proc, int pid, int tid, } if (hostname && !proc->hostname) { proc->hostname = strdup(hostname); - if (lookup_hostname_list(hostname)) { + if (is_hostname_filtered(hostname)) { add_filter_tid_list(tid, proc); } } @@ -669,26 +669,28 @@ struct tm format_timestamp(uint64_t timestamp) int *lookup_tid_list(int tid) { - if (!tid_list) + if (!tid_filter_list) return NULL; - return g_hash_table_lookup(tid_list, (gpointer) &tid); + return g_hash_table_lookup(tid_filter_list, (gpointer) &tid); } -char *lookup_hostname_list(const char *hostname) +struct host *lookup_hostname_list(const char *hostname) { - if (!hostname || !hostname_list) + if (!hostname || !global_host_list) return NULL; - return g_hash_table_lookup(hostname_list, (gpointer) hostname); + return g_hash_table_lookup(global_host_list, (gpointer) hostname); } -void remove_hostname_list(const char *hostname) +int is_hostname_filtered(const char *hostname) { - if (!hostname || !hostname_list) - return; + struct host *host; - g_hash_table_remove(hostname_list, (gpointer) hostname); + host = lookup_hostname_list(hostname); + if (host) + return host->filter; + return 0; } int *lookup_filter_tid_list(int tid)