Skip to content

Commit

Permalink
kernel: Make it compile on 3.18 (maybe older) kernels (#1460)
Browse files Browse the repository at this point in the history
input-event-codes.h:

Input: add input-event-codes header file
(torvalds/linux@f902dd8)
This was in 4.4-rc, so 4.4.0 or above has it else no.

aio.h:
fs: move struct kiocb to fs.h
(torvalds/linux@e2e40f2)

Below this version, we need to explicitly include aio.h for struct kiocb
This was in 4.1-rc, so 4.0 or below should do the include

uaccess.h, sched.h was present for long times, but 4.10 splited out to
include/sched/ but the current ifdef is not including uaccess.h for
lower versions than 4.4. Fix it.
  • Loading branch information
Royna2544 authored Mar 18, 2024
1 parent 95dc7fc commit d677046
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 1 addition & 4 deletions kernel/kernel_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
#include "linux/nsproxy.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
#include "linux/sched/task.h"
#include "linux/uaccess.h"
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
#include "linux/uaccess.h"
#include "linux/sched.h"
#else
#include "linux/sched.h"
#endif
#include "linux/uaccess.h"
#include "klog.h" // IWYU pragma: keep

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
Expand Down
8 changes: 8 additions & 0 deletions kernel/ksud.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
#include "linux/dcache.h"
#include "linux/err.h"
#include "linux/fs.h"
#include "linux/version.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
#include "linux/input-event-codes.h"
#else
#include "uapi/linux/input.h"
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
#include "linux/aio.h"
#endif
#include "linux/kprobes.h"
#include "linux/printk.h"
#include "linux/types.h"
Expand Down

0 comments on commit d677046

Please sign in to comment.