[PATCH] blkparse: ignore multiple process pid <-> name notifications
authorJens Axboe <axboe@suse.de>
Thu, 9 Feb 2006 15:09:06 +0000 (16:09 +0100)
committerJens Axboe <axboe@suse.de>
Thu, 9 Feb 2006 15:09:06 +0000 (16:09 +0100)
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

index daf83b25a359bc187d0f6eb188d3384cc4244f36..eb03b27f9f7dc271d6fcb33b26147722e7cfe17b 100644 (file)
@@ -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)