in reply to Accessing proc/memory

I haven't used /proc/*/mem yet and don't know anything about it, but my guess would be that it contains the virtual memory of each process, so that the first byte that you read would be *NULL, which is impossible to read. If my assumption is right, you should probably seek() to some mapped regions before you read.

Replies are listed 'Best First'.
Re^2: Accessing proc/memory
by Anonymous Monk on Aug 01, 2006 at 00:03 UTC
    That helped immensely! My understanding was that each mem file is what each process occupies in memory. But that's wrong. Instead, it's the image of my whole memory, and I can only read the sections which the specific process occupies.

    As per your suggestion, I added:

    use Fcntl qw(SEEK_SET); seek $fh, 134512640, SEEK_SET or die "could not seek in mem: $!";

    I got that number from converting from the hex address the maps file in /proc.