I just tried to read a file from kernel space. I called sys_open()..but when i try to load the module , it is saying sys_open undefined.
I can see in System.map file that this symbol has been exported.Why my module is saying like that? Can anybody help me why this error message comes ?or did i do any mistake..
A simple code which i tried to do..
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
#include <asm/uaccess.h>
static void read_file(char *filename)
{
int fd;
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
fd = sys_open(filename, O_RDONLY, 0);
sys_close(fd);
set_fs(old_fs);
}
static int __init init(void)
{
read_file("/home/suman/suman
.txt");
return 0;
}
static void __exit exit(void)
{ }
MODULE_LICENSE("GPL");
module_init(init);
module_exit(exit);
Error output:
Building modules, stage 2.
MODPOST
*** Warning: "sys_open" [/home/suman/amit_saha/amit/read_file/my_module/read_file_module.ko] undefined!
P.S: Please don't tell the it is not good to use sys_open.. I know ..just i want to see
Thanks
Suman
return 0;
}
static void __exit exit(void)
{ }
MODULE_LICENSE("GPL");
module_init(init);
module_exit(exit);
Error output:
Building modules, stage 2.
MODPOST
*** Warning: "sys_open" [/home/suman/amit_saha/amit/read_file/my_module/read_file_module.ko] undefined!
P.S: Please don't tell the it is not good to use sys_open.. I know ..just i want to see
Thanks
Suman