|
发表于 2006-3-29 11:38:49
|
显示全部楼层
my test result:
fd=open("/root/result1.tr",O_CREAT|O_RDWR,S_IRWXU);
will return -1, and the errno is set 14 (Bad address),
ps, if open success, i think it must call close() that finished create.
Post by camelguo
ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include <linux/module.h>
#include <linux/init.h>
#include <linux/config.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
_syscall3(int,open,const char *,file,int,flag,int,mode)
int errno;
#define __KERNEL_SYSCALLS__
#include <linux/fs.h>
static int __init vman_init(void)
{
printk("<1>Hello,world\n");
int fd;
fd=open("/root/result1.tr",O_CREAT|O_RDWR,S_IRWXU);
return 0;
}
static void __exit vman_exit(void)
{
printk("<1>Goodbye cruel world\n");
}
MODULE_DESCRIPTION("MAC-filter by Yuelei VMANE project, Northeastern University");
MODULE_AUTHOR("Yuelei");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
module_init(vman_init);
module_exit(vman_exit); |
|