Shared memory mapping question.

Gil Tene devil at techunix.BITNET
Thu Mar 22 03:07:07 AEST 1990


Hello netland...,

I am doing some work on a Sun, under SonOS 4.0.3, using the System V
shared memory interface. I have succesfully mapped and used shared memory
several times.  I am trying to solve the following problem:

I have one process creating a shared image of both data and data pointers,
and I would like the pointers in the shared data pointers map to point
to the correct data address in all processes, mapping the data and the
data pointers is easy, but since mapping (using shmat) is usually done
to a "randomly" selected virtual address in every process, meaning that
they get trough ok, but don't point to the data.

I am trying to avoid using "relative" pointers , i.e. index from data table
start, since speed is of crucial importance in my application.

I am aware of the fact that shmat() accepts a paddress argument, telling it
where to map the shared memory to (in the process virtual address space).

My problem is : How do i "allocate" a specific area in process virtual space,
in order to map the shared memory into it. How can i specify this virtual
process address as a constant, and where do i take it from (top of user
vir. address space, etc.). Allocating using sbrk() or malloc() variaties,
doesn't give me any way to control the exact address of the allocated block...

I am trying to  avoid the criminal act of assuming that all my
processes have a virtual address space smaller than some constant, and mapping
to an address above it. What I am looking for is a system call
that hides this act.

I would apreciate any help on this subject, and will summerize e-mail
responses to the net....

Thanks in advance...

        Gil Tene.

        devil at techunix.technion.ac.il
        devil at techunix.BITNET



More information about the Comp.unix.wizards mailing list