From 8f3817586f87cb65bc3b8b320ad8252a6a11f7e5 Mon Sep 17 00:00:00 2001 From: Alexander Lochmann Date: Wed, 6 Jul 2016 13:59:23 +0200 Subject: [PATCH 2/3] The syscall defines were not compatible with older kernels, namely 3.0.x Older kernels, at least the 3.0.x, define their syscalls in different files. The stap runtime has to include those file properly. Moreover, for pre-uprobe kernels no syscall file has been included at all. This job is normally done by task_finder.c. The task_finder_stubs.c has been extended by the needed include directive. --- runtime/linux/autoconf-asm-syscall.c | 8 +++++++- runtime/linux/task_finder_stubs.c | 1 + runtime/syscall.h | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/runtime/linux/autoconf-asm-syscall.c b/runtime/linux/autoconf-asm-syscall.c index bf7a273..6bfcd55 100644 --- a/runtime/linux/autoconf-asm-syscall.c +++ b/runtime/linux/autoconf-asm-syscall.c @@ -1,2 +1,8 @@ +#include +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,200) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) +#include +#include +#include +#else #include - +#endif diff --git a/runtime/linux/task_finder_stubs.c b/runtime/linux/task_finder_stubs.c index 700bb3d..39f9ec2 100644 --- a/runtime/linux/task_finder_stubs.c +++ b/runtime/linux/task_finder_stubs.c @@ -1,6 +1,7 @@ #ifndef TASK_FINDER_STUBS_C #define TASK_FINDER_STUBS_C +#include "syscall.h" /* Stubs of last resort for when utrace type functionality is not available. Nothing should actually work, but things compile properly, and silently return dummy data or noisily fail as diff --git a/runtime/syscall.h b/runtime/syscall.h index b959d46..b652946 100644 --- a/runtime/syscall.h +++ b/runtime/syscall.h @@ -7,7 +7,6 @@ * Public License (GPL); either version 2, or (at your option) any * later version. */ - #ifndef _SYSCALL_H_ /* -*- linux-c -*- */ #define _SYSCALL_H_ @@ -110,7 +109,14 @@ #ifdef STAPCONF_ASM_SYSCALL_H /* If the system has asm/syscall.h, use defines from it. */ +#include +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,200) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) +#include +#include +#include +#else #include +#endif #if defined(__arm__) /* The syscall_get_nr() function on 3.17.1-302.fc21.armv7hl always -- 2.7.4