From bad93acfba492954543a293dbf87769a6953d630 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Jul 2013 13:43:30 -0700 Subject: Fix compilation of QtTest on Linux systems with old kernel headers Hardcode our perf_event_open(2) function to simply return -1 and set errno to ENOSYS. This will disable the functionality. People compiling Qt with such old headers will probably carry quite a bit of dead code in QtTest. They should upgrade. Task-number: QTBUG-32507 Change-Id: I774b4a81bee5c3e2ddc75fa52520d123a6bebed9 Reviewed-by: Jason McDonald --- src/testlib/qbenchmarkperfevents.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/testlib') diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index e3034d1f94..acc11b09ac 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -130,7 +130,17 @@ static void initPerf() static int perf_event_open(perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags) { +#ifdef SYS_perf_event_open return syscall(SYS_perf_event_open, attr, pid, cpu, group_fd, flags); +#else + Q_UNUSED(attr); + Q_UNUSED(pid); + Q_UNUSED(cpu); + Q_UNUSED(group_fd); + Q_UNUSED(flags); + errno = ENOSYS; + return -1; +#endif } bool QBenchmarkPerfEventsMeasurer::isAvailable() -- cgit v1.2.3