The /proc/*/maps files list the virtual memory areas (VMAs) of a process and what, if anything, they are mapped to. A process typically has its own program executable and the libraries it needs mapped in, as well as VMAs for storing data, including the stack and the heap. If you read this file in the ordinary way, you get a sequential list of all VMAs in a text format.
- Linux manual page on
/proc/pid/maps(alsoman 5 proc_pid_maps) - Kernel documentation on the /proc filesystem
The PROCMAP_QUERY ioctl operation, added in kernel 6.11, lets you query for a specific VMA in various ways and get the response back as structured data.
- LWN article: "The rest of the 6.11 merge window"
- Git commit: ed5d583a88a9207b
fs/procfs: implement efficient VMA querying API for /proc/<pid>/maps(see also the other two commits mentioned in the LWN article) - API comments: see
include/uapi/linux/fs.hfrom kernel 6.11, starting at line 401 (also likely on your system at/usr/include/linux/fs.h) - Python docs on the
fcntlmodule, including theioctloperation
The file procmapquery.py implements a get_libraries() function that takes an open /proc/*/maps file and returns a set of mapped files. There is a brief main block, so you can run it with python3 procmapquery.py.