|
I am trying to modify some part of kernel, here I meet a problem. the struct that I defined in /sys/sys/proc.h can not be used , but struct proc could be used.
For example:
In file---------- ----/sys/sys/proc.h
struct proc /* old proc struct in proc.h*/
{ ... };
struct fox_test
{ int a; } ; /**my new defined struct */
In ------------------------/tmp/test.c
#include<fcntl.h>
#include<sys/param.h>
#include<sys/proc.h>
struct proc ppc;
//struct fox_test ftt;
/*
//if I add this line above("struct fox_test ftt;"), this file will fall in compile; error:storage size of 'ftt' isn't known
// however , this file could be compiled successfully without "struct fox_test ftt;"
*/
int main()
{
return 0;
}
>cc ./test.c
>error:storage size of 'ftt' isn't known
I even try to test this problem in /usr/src/bin/ps
I can define "struct proc ppc;" in ps.c , then I usd make command. It compiles correct.
But when I add "struct fox_test ftt; " ,then I usd make command. It fails with the same error;
简单的说 ,就是在sys/sys/proc.h中点添加自己的结构体fox_test.可是在.c文件中包含了头文件proc.h也不能定义fox_test类型的变量,错误信息是error:storage size of 'XXXX' isn't known
可是同在proc.h中的proc就可以使用。
thanks, |
|