Skip to content

Commit

Permalink
kernel: add workqueue demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Martins3 committed Dec 11, 2023
1 parent 41625f8 commit 607eae2
Show file tree
Hide file tree
Showing 9 changed files with 549 additions and 429 deletions.
4 changes: 2 additions & 2 deletions kernel/module/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ ifneq (${KERNELRELEASE},)
$(info call this in kernel environment)
obj-m += martins3.o

martins3-m := hello.o seq.o seq2.o sys.o
martins3-m := hello.o seq.o seq2.o sys.o workqueue.o
# Otherwise we were called directly from the command line.
# Invoke the kernel build system.
else
KERNEL_SOURCE := /home/martins3/core/linux
KERNEL_SOURCE := /home/martins3/core/linux-build
PWD := $(shell pwd)
default:
${MAKE} -C ${KERNEL_SOURCE} M=${PWD} modules
Expand Down
26 changes: 15 additions & 11 deletions kernel/module/hacking.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#ifndef HACKING_H_PA2UMYTB
#define HACKING_H_PA2UMYTB
enum hacking {
PR_INFO,
WATCH_DOG,
KTHREAD,
// 测试 https://docs.kernel.org/RCU/Design/Requirements/Requirements.html
RCU,
MUTEX,
MEMORY_MODEL_1, // load load,x86 上找不到
MEMORY_MODEL_2, // store load
SEQ_FILE_1,
SEQ_FILE_2,
SYS_FS,
PR_INFO,
WATCH_DOG,
KTHREAD,
// 测试 https://docs.kernel.org/RCU/Design/Requirements/Requirements.html
RCU,
MUTEX,
MEMORY_MODEL_1, // load load,x86 上找不到
MEMORY_MODEL_2, // store load
SEQ_FILE_1,
SEQ_FILE_2,
SYS_FS,
WORKQUEUE,
};

int simple_seq_init(void);
Expand All @@ -26,4 +27,7 @@ void simple_seq_fini3(void);
int sysfs_init(void);
void sysfs_exit(void);

int my_workqueue_init(void);
void my_workqueue_exit(void);

#endif /* end of include guard: HACKING_H_PA2UMYTB */
Loading

0 comments on commit 607eae2

Please sign in to comment.