From: Jens Axboe Date: Thu, 9 Feb 2006 15:09:06 +0000 (+0100) Subject: [PATCH] blkparse: ignore multiple process pid <-> name notifications X-Git-Tag: blktrace-0.99.1~55 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=248eac8f98dd5ef87b5f623b4c93cb5bde1143ea;p=blktrace.git [PATCH] blkparse: ignore multiple process pid <-> name notifications This can happen if you are doing multiple traces at the same time, then you would get a notification after a new trace has been set up. --- diff --git a/blkparse.c b/blkparse.c index daf83b2..eb03b27 100644 --- a/blkparse.c +++ b/blkparse.c @@ -516,17 +516,14 @@ static void add_ppm_hash(pid_t pid, const char *name) struct process_pid_map *ppm; ppm = find_ppm(pid); - if (ppm) { - fprintf(stderr, "Hmm ppm hash already exists %s/%d, this %s/%d\n", ppm->comm, ppm->pid, name, pid); - return; + if (!ppm) { + ppm = malloc(sizeof(*ppm)); + memset(ppm, 0, sizeof(*ppm)); + ppm->pid = pid; + strcpy(ppm->comm, name); + ppm->hash_next = ppm_hash_table[hash_idx]; + ppm_hash_table[hash_idx] = ppm; } - - ppm = malloc(sizeof(*ppm)); - memset(ppm, 0, sizeof(*ppm)); - ppm->pid = pid; - strcpy(ppm->comm, name); - ppm->hash_next = ppm_hash_table[hash_idx]; - ppm_hash_table[hash_idx] = ppm; } char *find_process_name(pid_t pid)