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 <macadder1@gmail.com>
This commit is contained in:
Thiago Macieira 2013-07-19 13:43:30 -07:00 committed by The Qt Project
parent 2ff2a7c32d
commit bad93acfba

View File

@ -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()