lkml.org 
[lkml]   [2001]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectSize 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.bak Fri Sep 21 19:55:22 2001
+++ mtrr.c Wed Oct 3 10:07:45 2001
@@ -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 */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:03    [W:0.034 / U:2.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site