lkml.org 
[lkml]   [2013]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 03/13] perf evlist: add initialzation function for tracepoints
Date
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


\
 
 \ /
  Last update: 2013-05-09 11:21    [W:0.976 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site