--- zzzz-none-000/linux-2.4.17/fs/proc/proc_misc.c 2001-11-21 05:29:09.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/fs/proc/proc_misc.c 2004-11-30 15:00:28.000000000 +0000 @@ -128,6 +128,83 @@ return proc_calc_metrics(page, start, off, count, eof, len); } +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +static int mem_map_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + int i; + int len = 0; + unsigned int once = (off == 0) ? 1 : 0; + extern mem_map_t * mem_map; + char Buffer[256]; + + /*--- printk("mem_map_read_proc: page=0x%p off=%ld count=%d\n", page, off, count); ---*/ + + *page = '\0'; /*--- string leeren ---*/ + for(i = max_mapnr ; i-- > 0 ; ) { + if(mem_map[i].count.counter == 0) + continue; + + Buffer[0] = '\0'; + if(once) { + once = 0; + len += sprintf(Buffer + strlen(Buffer), "mem_map=0x%8p, max_mapnr=%u size=%u\n", mem_map, max_mapnr, sizeof(mem_map_t)); + } + len += sprintf(Buffer + strlen(Buffer), + "[%03u] 0x%8p %04u 0x%04lX", + i, + mem_map[i].virtual, + mem_map[i].count.counter, + mem_map[i].flags + ); + + if(mem_map[i].flags & 0xFFFF) { + len += sprintf(Buffer + strlen(Buffer), + " (%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s)" + "\n", + mem_map[i].flags & (1 << PG_locked) ? " locked" : "", + mem_map[i].flags & (1 << PG_error) ? " error" : "", + mem_map[i].flags & (1 << PG_referenced) ? " referenced" : "", + mem_map[i].flags & (1 << PG_uptodate) ? " uptodate" : "", + mem_map[i].flags & (1 << PG_dirty) ? " dirty" : "", + mem_map[i].flags & (1 << PG_unused) ? " unused" : "", + mem_map[i].flags & (1 << PG_lru) ? " lru" : "", + mem_map[i].flags & (1 << PG_active) ? " active" : "", + mem_map[i].flags & (1 << PG_slab) ? " slab" : "", + mem_map[i].flags & (1 << PG_skip) ? " skip" : "", + mem_map[i].flags & (1 << PG_highmem) ? " highmem" : "", + mem_map[i].flags & (1 << PG_checked) ? " checked" : "", + mem_map[i].flags & (1 << PG_arch_1) ? " arch_1" : "", + mem_map[i].flags & (1 << PG_reserved) ? " reserved" : "", + mem_map[i].flags & (1 << PG_launder) ? " launder" : "" + ); + } + + if(len < off) { /*--- noch nicht so weit ---*/ + /*--- printk("skip: len(%u) < off(%lu)\n", len, off); ---*/ + continue; + } + if(len > off + count) { + /*--- printk("end: len(%u) > off(%lu) + count(%u)\n", len, off, count); ---*/ + break; + } + strcat(page, Buffer); + } + + if(len <= off + count) { + *eof = 1; + } + + *start = page; + + len = strlen(page); + if(len > count) len = count; + return len; +} + +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ static int meminfo_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -344,12 +421,14 @@ return proc_calc_metrics(page, start, off, count, eof, len); } +#ifdef CONFIG_GENERIC_ISA_DMA static int dma_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { int len = get_dma_list(page); return proc_calc_metrics(page, start, off, count, eof, len); } +#endif static int ioports_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) @@ -505,6 +584,7 @@ {"loadavg", loadavg_read_proc}, {"uptime", uptime_read_proc}, {"meminfo", meminfo_read_proc}, + {"mem_map", mem_map_read_proc}, {"version", version_read_proc}, #ifdef CONFIG_MODULES {"modules", modules_read_proc}, @@ -516,7 +596,9 @@ {"interrupts", interrupts_read_proc}, #endif {"filesystems", filesystems_read_proc}, +#ifdef CONFIG_GENERIC_ISA_DMA {"dma", dma_read_proc}, +#endif {"ioports", ioports_read_proc}, {"cmdline", cmdline_read_proc}, #ifdef CONFIG_SGI_DS1286 @@ -561,8 +643,28 @@ entry->proc_fops = &ppc_htab_operations; } #endif +#if defined (CONFIG_AVM_MEM_MONITORING) + entry = create_proc_read_entry ( + "allocated", + S_IWUSR | S_IRUGO, + NULL, + kmem_alloc_read_proc, + NULL + ); +#endif entry = create_proc_read_entry("slabinfo", S_IWUSR | S_IRUGO, NULL, slabinfo_read_proc, NULL); if (entry) entry->write_proc = slabinfo_write_proc; + +#if defined(CONFIG_AVALANCHE_CPU_FREQUENCY_SWITCHING) + { + extern int clocks_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); + extern int clocks_write_proc(struct file *file, const char *buffer, unsigned long count, void *data); + + entry = create_proc_read_entry("clocks", S_IWUSR | S_IRUGO, NULL, clocks_read_proc, NULL); + if (entry) + entry->write_proc = clocks_write_proc; + } +#endif /*--- #if defined(CONFIG_AVALANCHE_CPU_FREQUENCY_SWITCHING) ---*/ }