lkml.org 
[lkml]   [2012]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] perf: 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().

Signed-off-by: Stephane Eranian <eranian@google.com>
---

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 92af168..06f2d1a 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -167,7 +167,6 @@ sys_perf_event_open(struct perf_event_attr *attr,
pid_t pid, int cpu, int group_fd,
unsigned long flags)
{
- attr->size = sizeof(*attr);
return syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);
}
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 8131410..c1017b3 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -14,6 +14,8 @@ void event_attr_init(struct perf_event_attr *attr)
attr->exclude_host = 1;
if (!perf_guest)
attr->exclude_guest = 1;
+ /* to capture ABI version */
+ attr->size = sizeof(*attr);
}

int mkdir_p(char *path, mode_t mode)

\
 
 \ /
  Last update: 2012-02-09 16:15    [W:0.141 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site