Re: [PATCH 03/13] perf evlist: add initialzation function for tracepoints
From: Namhyung Kim
Date: Thu May 09 2013 - 04:40:17 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/