Size of file /proc/mtrr
Hy Folks!
I found a little problem about file /proc/mtrr: it shorter than it is...
zsiga-pc:/usr/src/linux# ls -l /proc/mtrr
-rw-r--r-- 1 root root 132 Oct 3 10:03 /proc/mtrr
^^^ zsiga-pc:/usr/src/linux# cat /proc/mtrr | wc -c
203
^^^zsiga-pc:/usr/src/linux# cat /proc/mtrr reg00: base=0x00000000 ( 0MB), size= 128MB: write-back, count=1 reg01: base=0x08000000 ( 128MB), size= 32MB: write-back, count=1 reg02: base=0xf5000000 (3920MB), size= 4MB: write-combining, count=1
zsiga-pc:/usr/src/linux# mc -v /proc/mtrr File: /proc/mtrr 132 bytes 100% reg00: base=0x00000000 ( 0MB), size= 128MB: write-back, count=1 reg01: base=0x08000000 ( 128MB), size= 32MB: write-back, count=1
I looked into arch/i386/kernel/mtrr.c, I found variable ascii_buf_bytes, wich contains the real length (203 in this case), and is copied into 'proc_root_mtrr->size' (line 1863) when changes.
The problem is that the procfs do not follow the changing of this value (caching problem ?), so stat(2) reports the old length (132).
Here is a quick workaround: set proc_root_mtrr->size to zero
mtrr.c Wed Oct 3 10:07:45 2001 renamed from mtrr.bak Fri Sep 21 19:55:22 2001 +1 -1
@@ -1860,7 +1860,7 @@ devfs_set_file_size (devfs_handle, ascii_buf_bytes); # ifdef CONFIG_PROC_FS if (proc_root_mtrr) - proc_root_mtrr->size = ascii_buf_bytes; + proc_root_mtrr->size = 0; # endif /* CONFIG_PROC_FS */ } /* End Function compute_ascii */