dimlee
dimlee

Reputation: 462

How does the Linux kernel create the /proc/$pid/maps file?

I am doing some memory introspection and it requires me to know how proc/$pid/maps is created. I'm a bit confused by the code found in http://lxr.free-electrons.com/source/fs/proc/base.c on line 2750 I notice that there is a definition in this struct for maps but I want to know for each pid_entry which kernel function creates the maps file. A link to the kernel module or block of code is sufficient.

Upvotes: 1

Views: 2667

Answers (1)

user4822941
user4822941

Reputation:

You did something weird with the link.

Clicking through few definitions reveals the file is generated on demand here: https://github.com/torvalds/linux/blob/bcf876870b95592b52519ed4aafcf9d95999bc9c/fs/proc/task_mmu.c#L271

(at least for the common mmu case)

the usual question: why are you asking?

Upvotes: 2

Related Questions