[Linux-ia64] /proc/pid/mem and stack variables

From: Maciej Golebiewski <maciej_at_ccrl-nece.technopark.gmd.de>
Date: 2001-01-13 03:20:20
Hello everyone,

I'm new on this list. I looked through the archives but could not
find answer to my problem.

I have a library that makes use of /proc/pid/mem entries in the
/proc pseudo-filesystem. It runs perfectly on IA32 under 2.2.12
(and some superficial tests suggest that it works under
2.4.0-test12 as well).

I have recompiled the library on IA64 under 2.4.0-test12
and using version 2.9-ia64-000216-final. The library works
OK except when the address it tries to access via /proc/pid/mem
refers to variables allocated on stack (e.g. local arrays defined
in functions).

This is a snippet of code used to access memory via /proc/pid/mem:

void mem_read (int fd, void *buf, void *addr, size_t len) {

	if (lseek (fd, (off_t)addr, SEEK_SET) == (off_t)-1)
                perror ("lseek");
	read (fd, buf, len);

lseek in this code fails (EINVAL) always when addr is address of
a variable allocated on stack.

I have no idea if the problem is because I'm doing something
wrong, or because /proc/pid/mem is not yet fully implemented on IA64.
I appreciate any hints and help with this.

Thanks in advance,

Maciej

-- 
Maciej Gołębiewski
golebiewski@ccrl-nece.de
http://www.ccrl-nece.technopark.gmd.de/~maciej
C&C Research Laboratories, NEC Europe Ltd., Sankt Augustin, Germany
Received on Fri Jan 12 08:24:07 2001

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:01 EST