diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/event.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 9d0985131252..ff866c4d2e2f 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -387,6 +387,7 @@ static int __event__synthesize_thread(union perf_event *comm_event, | |||
387 | DIR *tasks; | 387 | DIR *tasks; |
388 | struct dirent dirent, *next; | 388 | struct dirent dirent, *next; |
389 | pid_t tgid, ppid; | 389 | pid_t tgid, ppid; |
390 | int rc = 0; | ||
390 | 391 | ||
391 | /* special case: only send one comm event using passed in pid */ | 392 | /* special case: only send one comm event using passed in pid */ |
392 | if (!full) { | 393 | if (!full) { |
@@ -414,38 +415,38 @@ static int __event__synthesize_thread(union perf_event *comm_event, | |||
414 | 415 | ||
415 | while (!readdir_r(tasks, &dirent, &next) && next) { | 416 | while (!readdir_r(tasks, &dirent, &next) && next) { |
416 | char *end; | 417 | char *end; |
417 | int rc = 0; | ||
418 | pid_t _pid; | 418 | pid_t _pid; |
419 | 419 | ||
420 | _pid = strtol(dirent.d_name, &end, 10); | 420 | _pid = strtol(dirent.d_name, &end, 10); |
421 | if (*end) | 421 | if (*end) |
422 | continue; | 422 | continue; |
423 | 423 | ||
424 | rc = -1; | ||
424 | if (perf_event__prepare_comm(comm_event, _pid, machine, | 425 | if (perf_event__prepare_comm(comm_event, _pid, machine, |
425 | &tgid, &ppid) != 0) | 426 | &tgid, &ppid) != 0) |
426 | return -1; | 427 | break; |
427 | 428 | ||
428 | if (perf_event__synthesize_fork(tool, fork_event, _pid, tgid, | 429 | if (perf_event__synthesize_fork(tool, fork_event, _pid, tgid, |
429 | ppid, process, machine) < 0) | 430 | ppid, process, machine) < 0) |
430 | return -1; | 431 | break; |
431 | /* | 432 | /* |
432 | * Send the prepared comm event | 433 | * Send the prepared comm event |
433 | */ | 434 | */ |
434 | if (process(tool, comm_event, &synth_sample, machine) != 0) | 435 | if (process(tool, comm_event, &synth_sample, machine) != 0) |
435 | return -1; | 436 | break; |
436 | 437 | ||
438 | rc = 0; | ||
437 | if (_pid == pid) { | 439 | if (_pid == pid) { |
438 | /* process the parent's maps too */ | 440 | /* process the parent's maps too */ |
439 | rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid, | 441 | rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid, |
440 | process, machine, mmap_data); | 442 | process, machine, mmap_data); |
443 | if (rc) | ||
444 | break; | ||
441 | } | 445 | } |
442 | |||
443 | if (rc) | ||
444 | return rc; | ||
445 | } | 446 | } |
446 | 447 | ||
447 | closedir(tasks); | 448 | closedir(tasks); |
448 | return 0; | 449 | return rc; |
449 | } | 450 | } |
450 | 451 | ||
451 | int perf_event__synthesize_thread_map(struct perf_tool *tool, | 452 | int perf_event__synthesize_thread_map(struct perf_tool *tool, |