I would like to use do_mmap() in a kernel module. According to this question this should be possible.
Here is a minimal non-working example:
hp_km.c:
#include <linux/module.h>
#include <linux/mm.h>
MODULE_LICENSE("GPL");
static int __init hp_km_init(void) {
do_mmap(0, 0, 0, 0, 0, 0, 0, 0, 0);
return 0;
}
static void __exit hp_km_exit(void) {
}
module_init(hp_km_init);
module_exit(hp_km_exit);
Makefile:
obj-m += hp_km.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Running make
results in WARNING: "do_mmap" [...] undefined!
What do I need to change in hp_km.c
or Makefile
to make this work?