lkmpg/examples
fennecJ 870b26fa2d Update several example code for newer kernel
Known issues with current example code:
If you using newer kernel(e.g linux 5.11.x) to compile the example code,
you may meet following error:
1. syscall.c:83:50: error: ‘ksys_close’ undeclared;
2. cryptosk.c:17:24: error: field ‘sg’ has incomplete type
3. cryptosk.c:143:9: error: implicit declaration of function
‘get_random_bytes’
4. error: macro "DECLARE_TASKLET" passed 3 arguments, but takes just 2

Solutions/workaround:
1. In syscall.c, replace #include <linux/syscalls.h> with
#include <linux/fdtable.h> and replace  ksys_close with close_fd
if the kernel version >= 5.11. [1][2]
2. Add #include <linux/scatterlist.h> into cryptosk.c
3. Add #include <linux/random.h> into cryptosk.c
4. In bottomhalf.c and example_tasklet.c, replace DECLARE_TASKLET
with DECLARE_TASKLET_OLD and dispose third argument(0L). [3]

[1] - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1572bfdf21d4d50e51941498ffe0b56c2289f783
[2] - https://www.mail-archive.com/meta-arago@arago-project.org//msg11939.html
[3] - https://patchwork.kernel.org/project/kernel-hardening/patch/20200716030847.1564131-3-keescook@chromium.org/
2021-08-23 21:30:43 +08:00
..
other cat_nonblock: Use canonical name scheme and fix unintended assignment 2021-08-05 14:28:12 +08:00
.clang-format Enforce the customized style for example code 2021-07-22 06:58:13 +08:00
bottomhalf.c Update several example code for newer kernel 2021-08-23 21:30:43 +08:00
chardev.c Apply editorial changes 2021-08-08 01:24:59 +08:00
chardev.h Apply editorial changes 2021-08-08 01:24:59 +08:00
chardev2.c Fix typo: concurent -> concurrent 2021-08-12 07:43:38 +00:00
completions.c Apply editorial changes 2021-08-08 01:24:59 +08:00
cryptosha256.c Apply editorial changes 2021-08-08 01:24:59 +08:00
cryptosk.c Update several example code for newer kernel 2021-08-23 21:30:43 +08:00
devicemodel.c Apply editorial changes 2021-08-08 01:24:59 +08:00
example_atomic.c Apply editorial changes 2021-08-08 01:24:59 +08:00
example_mutex.c Apply editorial changes 2021-08-08 01:24:59 +08:00
example_rwlock.c Apply editorial changes 2021-08-08 01:24:59 +08:00
example_spinlock.c Apply editorial changes 2021-08-08 01:24:59 +08:00
example_tasklet.c Update several example code for newer kernel 2021-08-23 21:30:43 +08:00
hello-1.c Mention pr_info() rather than KERN_INFO 2021-08-16 21:53:22 +02:00
hello-2.c Mention pr_info() rather than KERN_INFO 2021-08-16 21:53:22 +02:00
hello-3.c Mention pr_info() rather than KERN_INFO 2021-08-16 21:53:22 +02:00
hello-4.c Mention pr_info() rather than KERN_INFO 2021-08-16 21:53:22 +02:00
hello-5.c Apply editorial changes 2021-08-08 01:24:59 +08:00
hello-sysfs.c Apply editorial changes 2021-08-08 01:24:59 +08:00
intrpt.c Apply editorial changes 2021-08-08 01:24:59 +08:00
ioctl.c Apply editorial changes 2021-08-08 01:24:59 +08:00
kbleds.c Update some file path to kernel v5.x+ in example/kbleds.c 2021-08-21 14:51:37 +08:00
Makefile Emphasize on 5.x kernel 2021-07-22 08:31:47 +08:00
print_string.c Make program style consistent again 2021-08-08 01:50:42 +08:00
procfs1.c Apply editorial changes 2021-08-08 01:24:59 +08:00
procfs2.c Apply editorial changes 2021-08-08 01:24:59 +08:00
procfs3.c Apply editorial changes 2021-08-08 01:24:59 +08:00
procfs4.c Fix alignment problem in code block (#45) 2021-08-08 01:29:50 +08:00
sched.c Apply editorial changes 2021-08-08 01:24:59 +08:00
sleep.c Fix init message 2021-08-10 00:48:19 +08:00
start.c Apply editorial changes 2021-08-08 01:24:59 +08:00
stop.c Apply editorial changes 2021-08-08 01:24:59 +08:00
syscall.c Update several example code for newer kernel 2021-08-23 21:30:43 +08:00