I read cat /proc/[pid]/maps
gives the informaion about its address space.
So I want to write a program which will print its own address space.
My program is this;
pid_t pid;
int fd;
char *buf;
pid = getpid();
fd = open("/proc/????/maps", O_RDONLY);
I'm getting the PID, but it won't help me to open the file.
How to convert the pid from pid_t
to string and add it to open
call?
Or is there any other way to open the file?