I have looked some at this, and I haven't come up with a good solution
for this. I have come up with the following solutions:
Open /proc/<pid>/mem and get the memory directly. This has two problems:
* You have to ptrace() the process to do this. Actually, that seems
a little silly. Why do you have to ptrace() the process to do this?
* The whole file might not be mapped, thus the section of the file
that is interesting might not be in memory.
Another solution I thought of was to provide a /proc/<pid>/mapped_files
directory that works like the /proc/<pid>/fd directory. Unfortunately,
it looks very difficult to implement this because of the need to provide
consistent inodes. For fds, you have an easy way to generate inodes
with the fd number. For mmap-ed memory, you don't have a relatively
small number to do this with.
The last solution I could think of was to provide a way to open a file
with using the major/minor/inode (since these are listed for the mapped
files in the /proc/<pid>/maps file). This is kind of ugly, but it's
probably the best one I've thought of.
Any more ideas? Maybe there's an easy way to do this that I haven't found.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/