Operations on the as entry

Given that the as entry is the virtual address space of the process, what can we do with it? The as entity was made to look like a file so that you could perform file-like functions on it (read(), write(), and lseek()). Of course, you have to have the appropriate permissions, as described in Controlling processes via the /proc filesystem in the Processes chapter of the QNX Neutrino Programmer's Guide.

For example, if we call lseek() to seek to location 0x80001234, and then call read() to read 4 bytes, we have effectively read 4 bytes from the process's virtual address space at 0x80001234. If we then print out this value, it would be equivalent to doing the following code within that process:


int     *ptr;

ptr = (int *) 0x80001234;
printf ("4 bytes at location 0x80001234 are %d\n", *ptr);

However, the big advantage is that we can read the data in another process's address space by calling lseek() and read().