* [PATCH] Fix build on kernels without perf_event_attr exclude_callchain_kernel.
@ 2013-05-24 4:08 Vinson Lee
2013-05-24 14:34 ` Dave Jones
0 siblings, 1 reply; 2+ messages in thread
From: Vinson Lee @ 2013-05-24 4:08 UTC (permalink / raw)
To: trinity; +Cc: Vinson Lee
From: Vinson Lee <vlee@twitter.com>
This patch fixes these build errors on 3.6 and older.
CC syscalls/perf_event_open.o
syscalls/perf_event_open.c: In function ‘create_mostly_valid_counting_event’:
syscalls/perf_event_open.c:382:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_kernel’
syscalls/perf_event_open.c:383:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_user’
syscalls/perf_event_open.c: In function ‘create_mostly_valid_sampling_event’:
syscalls/perf_event_open.c:431:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_kernel’
syscalls/perf_event_open.c:432:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_user’
make: *** [syscalls/perf_event_open.o] Error 1
Signed-off-by: Vinson Lee <vlee@twitter.com>
---
configure.sh | 26 ++++++++++++++++++++++++++
syscalls/perf_event_open.c | 4 ++++
2 files changed, 30 insertions(+)
diff --git a/configure.sh b/configure.sh
index e676418..4be1e59 100755
--- a/configure.sh
+++ b/configure.sh
@@ -182,6 +182,32 @@ else
fi
#############################################################################################
+# Does perf_event_attr have exclude_callchain_kernel?
+
+echo -n "[*] Checking if perf_event_attr can use exclude_callchain_kernel.. "
+rm -f "$TMP" || exit 1
+
+cat >"$TMP.c" << EOF
+#include <stdio.h>
+#include <linux/perf_event.h>
+
+int main() {
+ struct perf_event_attr attr;
+ printf("%d\n", attr.exclude_callchain_kernel);
+}
+EOF
+
+${CC} "$TMP.c" -o "$TMP" &>"$TMP.log"
+
+if [ ! -x "$TMP" ]; then
+ echo $RED "[NO]" $COL_RESET
+ MISSING_DEFS=1
+else
+ echo $GREEN "[YES]" $COL_RESET
+ echo "#define USE_PERF_EVENT_EXCLUDE_CALLCHAINS" >> config.h
+fi
+
+#############################################################################################
check_header linux/caif/caif_socket.h USE_CAIF
check_header linux/if_alg.h USE_IF_ALG
diff --git a/syscalls/perf_event_open.c b/syscalls/perf_event_open.c
index 627ba48..bffd33d 100644
--- a/syscalls/perf_event_open.c
+++ b/syscalls/perf_event_open.c
@@ -379,8 +379,10 @@ static void create_mostly_valid_counting_event(struct perf_event_attr *attr)
attr->sample_id_all = rand_bool();
attr->exclude_host = rand_bool();
attr->exclude_guest = rand_bool();
+#ifdef USE_PERF_EVENT_EXCLUDE_CALLCHAINS
attr->exclude_callchain_kernel = rand_bool();
attr->exclude_callchain_user = rand_bool();
+#endif
attr->wakeup_events = rand(); // also wakeup_watermark
@@ -428,8 +430,10 @@ static void create_mostly_valid_sampling_event(struct perf_event_attr *attr)
attr->sample_id_all = rand_bool();
attr->exclude_host = rand_bool();
attr->exclude_guest = rand_bool();
+#ifdef USE_PERF_EVENT_EXCLUDE_CALLCHAINS
attr->exclude_callchain_kernel = rand_bool();
attr->exclude_callchain_user = rand_bool();
+#endif
attr->wakeup_events = rand(); // also wakeup_watermark
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix build on kernels without perf_event_attr exclude_callchain_kernel.
2013-05-24 4:08 [PATCH] Fix build on kernels without perf_event_attr exclude_callchain_kernel Vinson Lee
@ 2013-05-24 14:34 ` Dave Jones
0 siblings, 0 replies; 2+ messages in thread
From: Dave Jones @ 2013-05-24 14:34 UTC (permalink / raw)
To: Vinson Lee; +Cc: trinity, Vinson Lee
On Thu, May 23, 2013 at 09:08:47PM -0700, Vinson Lee wrote:
> From: Vinson Lee <vlee@twitter.com>
>
> This patch fixes these build errors on 3.6 and older.
>
> CC syscalls/perf_event_open.o
> syscalls/perf_event_open.c: In function ‘create_mostly_valid_counting_event’:
> syscalls/perf_event_open.c:382:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_kernel’
> syscalls/perf_event_open.c:383:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_user’
> syscalls/perf_event_open.c: In function ‘create_mostly_valid_sampling_event’:
> syscalls/perf_event_open.c:431:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_kernel’
> syscalls/perf_event_open.c:432:6: error: ‘struct perf_event_attr’ has no member named ‘exclude_callchain_user’
> make: *** [syscalls/perf_event_open.o] Error 1
>
> Signed-off-by: Vinson Lee <vlee@twitter.com>
> ---
> configure.sh | 26 ++++++++++++++++++++++++++
> syscalls/perf_event_open.c | 4 ++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/configure.sh b/configure.sh
> index e676418..4be1e59 100755
> --- a/configure.sh
> +++ b/configure.sh
> @@ -182,6 +182,32 @@ else
> fi
thanks, applied.
Dave
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-24 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-24 4:08 [PATCH] Fix build on kernels without perf_event_attr exclude_callchain_kernel Vinson Lee
2013-05-24 14:34 ` Dave Jones
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.