In file included from include/asm-generic/int-ll64.h:10:0, from /home/charles/code/linux-3.10.28/include/uapi/asm-generic/types.h:7, from arch/arm/include/generated/asm/types.h:1, from include/uapi/linux/types.h:4, from include/linux/types.h:5, from include/linux/list.h:4, from include/linux/module.h:9, from /home/charles/code/modules/testproc.c:5: include/uapi/asm-generic/int-ll64.h:19:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef' typedef __signed__ char __s8; ^ In file included from include/linux/list.h:4:0, from include/linux/module.h:9, from /home/charles/code/modules/testproc.c:5: include/linux/types.h:98:1: error: unknown type name '__s8' typedef __s8 int8_t; ^ In file included from include/linux/quota.h:42:0, from include/linux/fs.h:245, from include/linux/proc_fs.h:8, from /home/charles/code/modules/testproc.c:6: /home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:51:2: error: unknown type name '__s8' __s8 d_version; /* version of this structure */ ^ /home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:52:2: error: unknown type name '__s8' __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */ ^ /home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:153:2: error: unknown type name '__s8' __s8 qs_version; /* version number for future changes */ ^ /home/charles/code/linux-3.10.28/include/uapi/linux/dqblk_xfs.h:155:2: error: unknown type name '__s8' __s8 qs_pad; /* unused */
这些报错完全是在内核代码里的,查了半天也没找出问题。。
后来看了下自己的代码,发现在一个注释行开头,多了个字母 i...
<strong><span style="color:#FF0000;">i</span></strong>/*This program is used to allocate memory in kernel and pass the physical address to userspace through proc file.*/ #include <linux/version.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <linux/mm.h>
去掉之后,上面的问题就没了。