Messages in this thread | | | From | Namhyung Kim <> | Subject | Re: [PATCH 03/13] perf evlist: add initialzation function for tracepoints | Date | Thu, 09 May 2013 17:40:03 +0900 |
| |
Hi David,
On Wed, 8 May 2013 22:31:39 -0600, David Ahern wrote: > Handles initializations typically done as part of processing the file > header and HEADER_TRACING_DATA event. > [SNIP] > +int perf_evlist__trace_init(struct perf_evlist *evlist, > + struct perf_session *session) > +{ > + struct tracing_data *tdata; > + char temp_file[] = "/tmp/perf-XXXXXXXX"; > + int fd; > + > + fd = mkstemp(temp_file); > + if (fd < 0) { > + pr_err("mkstemp failed\n"); > + return -1; > + } > + unlink(temp_file); > + > + tdata = tracing_data_get(&evlist->entries, fd, false); > + if (!tdata) > + return -1; > + > + lseek(fd, 0, SEEK_SET); > + (void) trace_report(fd, &session->pevent, false); > + tracing_data_put(tdata);
I guess you need to close the fd here.
> + > + return perf_evlist__prepare_tracepoint_events(evlist, session->pevent); > +}
Thanks, Namhyung
| |