To communicate in kernel mode and user space, I am using this C program. I am using following Makefile to create .ko file to load.
bj-m := sysctl_test.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
After successful execution, and loading the .ko file, it should have create /proc/sys/net/test directory, and value1 and value2 file in that directory.
When I load this module, it doesn't create any file or directory. Am I doing something wrong here or code need some changes?
I have tried by modifying values in structures as:
static ctl_table test_net_table[] = {
{
...
.procname = "/proc/sys/net/test",
...
},
{ .ctl_name = 0 }
};
static ctl_table test_root_table[] = {
{
...
.procname = "/proc/sys/net/",
...
},
{ .ctl_name = 0 }
};
The original values was test and net respectively.
Thanks for your time!
Try changing
to
it worked for me.
PS:Its an old question, but I update answer for those who come across same error and stop her.