我是 linux、C 和堆栈溢出的新手。我试图查看所有正在运行的进程的页表。为此,我正在使用dump_pagetable.c。
我尝试通过正常编译先运行gcc dump_pagetables.c -o dump_pagetables.out
。但它给了我错误:
dump_pagetable.c:15:27: fatal error: linux/debugfs.h: No such file or directory #include linux/debugfs.h></code><br/><br/>Then I tried to use a make command <code>make -C /lib/modules/$(uname -r)/build M=$PWD modules</code>. So it gave me this error<code>CC [M] /home/varma/Desktop/TLB/dump_pagetable.o
/home/varma/Desktop/TLB/dump_pagetable.c:420:1: warning: data definition has no type or storage class
__initcall(pt_dump_init);
^
/home/varma/Desktop/TLB/dump_pagetable.c:420:1: error: type defaults to ‘int’ in declaration of ‘__initcall’ [-Werror=implicit-int]
/home/varma/Desktop/TLB/dump_pagetable.c:420:1: warning: parameter names (without types) in function declaration
/home/varma/Desktop/TLB/dump_pagetable.c:398:12: warning: ‘pt_dump_init’ defined but not used [-Wunused-function]
static int pt_dump_init(void)
^
cc1: some warnings being treated as errors
scripts/Makefile.build:263: recipe for target '/home/varma/Desktop/TLB/dump_pagetable.o' failed
make[1]: *** [/home/varma/Desktop/TLB/dump_pagetable.o] Error 1
Makefile:1394: recipe for target '_module_/home/varma/Desktop/TLB' failed
make: *** [_module_/home/varma/Desktop/TLB] Error 2
make: Leaving directory '/usr/src/linux-headers-3.19.0-23-generic'</code>
- 如何让这段代码运行?
- 如何修改
dump_pagetables.c
以便我也可以看到大页面。