From: Vinson Lee <vlee@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe trinity" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html