Commit 7e1ccd38 authored by Stephane Eranian's avatar Stephane Eranian Committed by Arnaldo Carvalho de Melo

perf tools: cleanup initialization of attr->size

The perf_event_attr size needs to be initialized in all cases because it
captures the ABI version.

This patch moves the initialization of the field from the
perf_event_open() syscall stub to its proper location in the
event_attr_init().

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120209151238.GA10272@quadSigned-off-by: default avatarStephane Eranian <eranian@google.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f1c67db7
...@@ -167,7 +167,6 @@ sys_perf_event_open(struct perf_event_attr *attr, ...@@ -167,7 +167,6 @@ sys_perf_event_open(struct perf_event_attr *attr,
pid_t pid, int cpu, int group_fd, pid_t pid, int cpu, int group_fd,
unsigned long flags) unsigned long flags)
{ {
attr->size = sizeof(*attr);
return syscall(__NR_perf_event_open, attr, pid, cpu, return syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags); group_fd, flags);
} }
......
...@@ -14,6 +14,8 @@ void event_attr_init(struct perf_event_attr *attr) ...@@ -14,6 +14,8 @@ void event_attr_init(struct perf_event_attr *attr)
attr->exclude_host = 1; attr->exclude_host = 1;
if (!perf_guest) if (!perf_guest)
attr->exclude_guest = 1; attr->exclude_guest = 1;
/* to capture ABI version */
attr->size = sizeof(*attr);
} }
int mkdir_p(char *path, mode_t mode) int mkdir_p(char *path, mode_t mode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment