aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-12-02 23:55:24 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-12-02 23:55:24 -0500
commitec350cbbabfb98965565a6d220b40f56a598be7f (patch)
treed8e8e3c81c07cef1ae206626911387a29ab005b5
parent7b556d9f717b8bba337e6772d5530547278a1a6f (diff)
Reset cpu data page offset when page is not mapped
When we reach the end of the data file and unmap the page, we must also reset the page offset, otherwise the tracecmd_read_at gets confused, and may think that a page can be mapped when it is not. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-input.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/trace-input.c b/trace-input.c
index eead50c..ac177f0 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -472,6 +472,7 @@ static int get_next_page(struct tracecmd_handle *handle, int cpu)
472 if (handle->cpu_data[cpu].size <= handle->page_size) { 472 if (handle->cpu_data[cpu].size <= handle->page_size) {
473 free(handle->cpu_data[cpu].page); 473 free(handle->cpu_data[cpu].page);
474 handle->cpu_data[cpu].page = NULL; 474 handle->cpu_data[cpu].page = NULL;
475 handle->cpu_data[cpu].offset = 0;
475 return 0; 476 return 0;
476 } 477 }
477 478
@@ -496,8 +497,10 @@ static int get_next_page(struct tracecmd_handle *handle, int cpu)
496 munmap(handle->cpu_data[cpu].page, handle->page_size); 497 munmap(handle->cpu_data[cpu].page, handle->page_size);
497 handle->cpu_data[cpu].page = NULL; 498 handle->cpu_data[cpu].page = NULL;
498 499
499 if (handle->cpu_data[cpu].size <= handle->page_size) 500 if (handle->cpu_data[cpu].size <= handle->page_size) {
501 handle->cpu_data[cpu].offset = 0;
500 return 0; 502 return 0;
503 }
501 504
502 update_cpu_data_index(handle, cpu); 505 update_cpu_data_index(handle, cpu);
503 506