aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/perf.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-12 06:46:55 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-12 08:28:52 -0400
commit974802eaa1afdc87e00821df7020a2b3c6fee623 (patch)
treeb5c38bece7f4948fe9d5cf9be02a0042e0fa39f6 /tools/perf/perf.h
parentbbd36e5e6aa6f1757c84cdb406b6eb81686d14af (diff)
perf_counter: Add forward/backward attribute ABI compatibility
Provide for means of extending the perf_counter_attr in a 'natural' way. We allow growing the structure by appending fields at the end by specifying the full structure size inside it. When a new kernel sees a smaller (old) structure, it will 0 pad the tail. When an old kernel sees a larger (new) structure, it will verify the tail consists of 0s, otherwise fail. If we fail due to a size-mismatch, we return -E2BIG and write the kernel's native attribe size back into the provided structure. Furthermore, add some attribute verification, so that we'll fail counter creation when unknown bits are present (PERF_SAMPLE, PERF_FORMAT, or in the __reserved fields). (This ABI detail is introduced while keeping the existing syscall ABI.) Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/perf.h')
-rw-r--r--tools/perf/perf.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index af0a5046d743..87a1aca4a424 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -53,11 +53,12 @@ static inline unsigned long long rdclock(void)
53 _min1 < _min2 ? _min1 : _min2; }) 53 _min1 < _min2 ? _min1 : _min2; })
54 54
55static inline int 55static inline int
56sys_perf_counter_open(struct perf_counter_attr *attr_uptr, 56sys_perf_counter_open(struct perf_counter_attr *attr,
57 pid_t pid, int cpu, int group_fd, 57 pid_t pid, int cpu, int group_fd,
58 unsigned long flags) 58 unsigned long flags)
59{ 59{
60 return syscall(__NR_perf_counter_open, attr_uptr, pid, cpu, 60 attr->size = sizeof(*attr);
61 return syscall(__NR_perf_counter_open, attr, pid, cpu,
61 group_fd, flags); 62 group_fd, flags);
62} 63}
63 64