shmat() system call?
Thomas Tornblom
thomas at uplog.se
Thu Aug 16 20:32:52 AEST 1990
In article <187 at n4hgf.Mt-Park.GA.US> wht at n4hgf.Mt-Park.GA.US (Warren Tucker) writes:
In article <27 at astph.UUCP> jeff at astph.UUCP (8592x2) writes:
>
>Question concerning the shared memory attach call:
>
>I am writing a shared memory allocation manager for a multi-user
>database.
>I need to know if additional attaches by other processes will be
>guaranteed to return the same address as that the first process
>was returned.
To be sure, specify the attach address, regardless of what the FM says.
Make a small program that passes 0 for the address and see what it
returns. Then, use that value hardcoded, possibly #defined for each
arcitecture you plan to run the program on.
[example deleted]
This is not guaranteed to work. Typically the kernel allocates the addresses
depending of the memory layout of the running process.
Our sysV.2 68k kernel uses the current end of bss rounded up with some
constant as the lowest base for shm. It also checks that the segment doesn't
overlap into the stack or other shared memory segments.
If you must have the same addresses between the processes (which is nice for
pointers and stuff) I'd pick some high constant address, say 0x[48c]0000000
or so that isn't likely to map onto anything on the architectures you're using.
Thomas
--
Real life: Thomas Tornblom Email: thomas at uplog.se
Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406
Box 1218 Fax: +46 18 132039
S - 751 42 Uppsala, Sweden
More information about the Comp.unix.wizards
mailing list