ryan
ryan

Reputation: 1463

Scanning memory in C/UNIX

I need to scan the entire memory of the calling process of my program and separate check which blocks are read-only, read-write, or inaccessible. It sounds pretty straight forward but I'm having trouble getting started. I'm wondering if anyone can point me in the right direction by providing relevant functions for scanning the memory of a calling process

For example, to start off, how would I obtain the starting and ending memory addresses of the calling process?

Upvotes: 0

Views: 349

Answers (1)

PaulProgrammer
PaulProgrammer

Reputation: 17630

This might be kernel dependent, but on Linux the /proc file system can access it:

/proc/[pid]/mem is the contents of the memory by a process, so you just have to identify your parent's pid, and if you have access you can scan it.

The actual layout of the file will depend somewhat on the executable type and kernel in question.

http://linux.die.net/man/5/proc

Upvotes: 1

Related Questions