From 248eac8f98dd5ef87b5f623b4c93cb5bde1143ea Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 9 Feb 2006 16:09:06 +0100 Subject: [PATCH] [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. --- blkparse.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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) -- 2.25.1