aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-24 21:48:21 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-24 21:48:21 -0500
commit3ed7f0839f5d184b24f60f77913f3ce2bf0df56a (patch)
tree7aa3cae0fd789a4ee241f03d26a0a5f6dad72b6e
parent19d0f76c798aa3aa90b4652e8c6bb00a5b147b14 (diff)
trace-cmd: Do not bail on failing mmap on second CPU if first had no size
If the first CPU had no size, and the second CPU failed to mmap, do not fail the entire trace-cmd report. The mmap check is not done on CPUs with no size. If the mmap fails, then check the previous CPUs to see if any of them had size, and if so then bail. But if none did, then continue. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-input.c14
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)
1707static int init_cpu(struct tracecmd_input *handle, int cpu) 1707static 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;