On Fri, Mar 03, 2000 at 01:04:08PM +0530, Rohit wrote:
> > > Is there any library function supported by gcc, which takes a void pointer and
> > > returns true if that memory (pointed by that void pointer) is owned by that
> > > process or not?
> > You have some basic misconceptions here.
>
> Arun, probably the question is if there is a way to tell, for a process,
> whether some absolute location is owned by it or not. Or even this is an
> invalid question?
It is. Because a process owns all of its virtual memory. If the question
is - will there be a core dump if a process accesses a particular memory
location, the answer can vary over time. So unless you mlock(2) your whole
memory, you can't trust the answer.
A good approximation would be to catch SIGSEGV or SIGBUS in a signal handler
and take appropriate action and continue from there. setjmp(3) and longjmp(3)
can be your friends.
-Arun
-----------------------------------------------------------------------
The LIH mailing list archives are available at:
http://lists.linux-india.org/cgi-bin/wilma/linux-india-help