diff options
-rw-r--r-- | trace-input.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/trace-input.c b/trace-input.c index ecf86e4..b9cdf09 100644 --- a/trace-input.c +++ b/trace-input.c | |||
@@ -1707,6 +1707,7 @@ tracecmd_read_prev(struct tracecmd_input *handle, struct record *record) | |||
1707 | static int init_cpu(struct tracecmd_input *handle, int cpu) | 1707 | static int init_cpu(struct tracecmd_input *handle, int cpu) |
1708 | { | 1708 | { |
1709 | struct cpu_data *cpu_data = &handle->cpu_data[cpu]; | 1709 | struct cpu_data *cpu_data = &handle->cpu_data[cpu]; |
1710 | int i; | ||
1710 | 1711 | ||
1711 | cpu_data->offset = cpu_data->file_offset; | 1712 | cpu_data->offset = cpu_data->file_offset; |
1712 | cpu_data->size = cpu_data->file_size; | 1713 | cpu_data->size = cpu_data->file_size; |
@@ -1724,9 +1725,16 @@ static int init_cpu(struct tracecmd_input *handle, int cpu) | |||
1724 | perror("mmap"); | 1725 | perror("mmap"); |
1725 | fprintf(stderr, "Can not mmap file, will read instead\n"); | 1726 | fprintf(stderr, "Can not mmap file, will read instead\n"); |
1726 | 1727 | ||
1727 | if (cpu) | 1728 | if (cpu) { |
1728 | /* Other CPUs worked! bail */ | 1729 | /* |
1729 | return -1; | 1730 | * If the other CPUs had size and was able to mmap |
1731 | * then bail. | ||
1732 | */ | ||
1733 | for (i = 0; i < cpu; i++) { | ||
1734 | if (handle->cpu_data[i].size) | ||
1735 | return -1; | ||
1736 | } | ||
1737 | } | ||
1730 | 1738 | ||
1731 | /* try again without mmapping, just read it directly */ | 1739 | /* try again without mmapping, just read it directly */ |
1732 | handle->read_page = 1; | 1740 | handle->read_page = 1; |