想做一个获取系统监控信息的小程序,网上经常说从/dev/kmem中读取,看top的源码也是这样,可是/dev/kmem中数据的格式是什么啊?有没有这方面介绍的书籍?我都不知道里面的格式怎么取啊?网上也没查到,请大家指点!
RHEL3,内核与gcc全部是系统自带。 程序中相关代码: [code] fd_kmem = open("/dev/kmem", O_RDWR); ptr_idt = get_addr_idt(); descriptor = (struct descriptor_idt *) malloc(sizeof(struct descriptor_idt)); ...... readkmem(descriptor, ptr_idt + 8 * x, sizeof(struct descriptor_idt)); ...... void readkmem(void *m, unsigned off, int size) { int i; ...
今天看了Linuxon-the-flykernelpatchingwithoutLKM里面有段代码是从/dev/kmem中找sys_call_talbe的地址,但在我的机器上编译,提示read kmem:bad address,我的内核是2.4.20-8,请指教,谢谢
[CODE/]
/*
sys_call_table in /usr/include/syscall.h
system_call int /usr/include/asm/unistd.h
*/
#include
[code]
#include
内核版本:2.6.12.9; 利用0x80终端访问/dev/kmem文件,open该文件正常返回,lseek文件正常返回,read文件时返回值为-1,请高人指点: 主要代码如下: ..... kmem=open(filename,O_RDONLY,0640); ..... off_r=lseek(kmem,off,0); printk("off_r is : %x\n",off_r); if(off_r!=off){ printk("kmem lseek error in read\n"); return; } // printk("mem is %x\n",(unsigned)*m); sz_r=read(kmem,m,sz); // printk("mem is %x...
I have a problem on RHEL4. I can not find the file /dev/kmem. I can find this file on Linux WS 3.0 and AS 3.0. So I want to know if the RedHat move this file to the other? :em14:
/mm/slab.c [code]283 struct kmem_cache_s { 284 /* 1) per-cpu data, touched during every alloc/free */ 285 struct array_cache *array[NR_CPUS]; 286 unsigned int batchcount; 287 unsigned int limit;[/code] 上面是slab高速缓存结构的前几个成员. 请教 一个高速缓存怎样与各CPU之间建立联系,?? 有没有相关资料? 谢谢!
1、谁能介绍一下/unix文件中的内容啊?我用tail /unix发现里面内容太多,而且显示的非常乱。 我看top源码中用到过 #define VMUNIX "/unix" static struct nlist nlst[] = { { "v" }, /* 0 */ { "proc" }, /* 1 */ { "freemem" }, /* 2 */ { "availrmem" }, /* 3 */ { "availsmem" }, /* 4 */ { "maxmem" }, /* 5 */ { "physmem" }, /* 6 */ { "nswap" }, /* 7 */ { "Hz" }, /* 8 */ { "mpid" },...
帖子发在linux分论坛,内核源代码学习版了,但是那里人太少,同样的也不好发两遍,还是做个广告链接吧! :em17: :em17: http://linux.chinaunix.net/bbs/thread-913690-1-1.html 斑竹多包涵,纯粹为了交流! :em17: :em17: