make 后的错误信息如下:
[root@localhost test]# make
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -I/usr/src/linux-2.4.20-8/include -c test.c
test.c: In function `read_test':
test.c:14: warning: implicit declaration of function `verify_area'
test.c:14: `VERIFY_WRITE' undeclared (first use in this function)
test.c:14: (Each undeclared identifier is reported only once
test.c:14: for each function it appears in.)
test.c:19: warning: implicit declaration of function `__put_user'
test.c:20: warning: statement with no effect
test.c: In function `open_tibet':
test.c:32: `MOD_INC_USE_COUNT' undeclared (first use in this function)
test.c: In function `release_tibet':
test.c:37: `MOD_DEC_USE_COUNT' undeclared (first use in this function)
test.c: At top level:
test.c:42: warning: initialization from incompatible pointer type
test.c:43: `write_test' undeclared here (not in a function)
test.c:43: initializer element is not constant
test.c:43: (near initialization for `test_fops.write')
test.c:48: `open_test' undeclared here (not in a function)
test.c:48: initializer element is not constant
test.c:48: (near initialization for `test_fops.open')
test.c:49: `release_test' undeclared here (not in a function)
test.c:49: initializer element is not constant
test.c:49: (near initialization for `test_fops.release')
test.c:27: warning: `write_tibet' defined but not used
test.c:31: warning: `open_tibet' defined but not used
test.c:36: warning: `release_tibet' defined but not used
make: *** [test.o] Error 1
========================================================================
我makefile 如下:
C=gcc
MODCFLAGS:=-Wall -DMODULE -D__KERNEL__ -DLINUX -I/usr/src/linux-2.4.20-8/include
test.o:test.c
$(CC) $(MODCFLAGS) -c test.c
========================================================================
我的C源程序如下:
#include
#include
#include
#include
#include
unsigned int test_major = 0;
static int read_test(struct inode *node, struct file *file,
char *buf, int count)
{
int left;
if (verify_area(VERIFY_WRITE,buf,count) == -EFAULT )
return -EFAULT;