--- kernel/acct.c.0 2006-03-20 14:53:29.000000000 +0900 +++ kernel/acct.c 2008-08-10 11:04:43.000000000 +0900 @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include /* sector_div */ @@ -605,3 +606,39 @@ void acct_clear_integrals(struct task_st tsk->acct_vm_mem1 = 0; } } + +#ifdef CONFIG_PROC_FS +static int acct_read_proc(char *page, char **start, off_t off, int count, + int *eof, void *data) +{ + int ret; + + spin_lock(&acct_globals.lock); + if(acct_globals.file) { + ret = sprintf(page, "on %s %s\n", + acct_globals.active ? "active":"paused", + acct_globals.file->f_dentry->d_name.name); + } else { + ret = sprintf(page, "off\n"); + } + spin_unlock(&acct_globals.lock); + + *eof = (ret < off+count) ? 1:0; + *start = page + off; + ret -= off; + if(ret > count) { + ret = count; + } + if(ret < 0) { + ret = 0; + } + return ret; +} + +static int __init acct_proc_init(void) +{ + create_proc_read_entry("acct", S_IRUGO, NULL, acct_read_proc, NULL); + return 0; +} +__initcall(acct_proc_init); +#endif