Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!sics.se!uplog.se!uplog.uplog.se!thomas From: thomas@uplog.se (Thomas Tornblom) Newsgroups: comp.unix.wizards Subject: Re: shmat() system call? Message-ID: Date: 16 Aug 90 10:32:52 GMT References: <27@astph.UUCP> <187@n4hgf.Mt-Park.GA.US> Sender: thomas@uplog.se (Thomas Tornblom) Organization: TeleLOGIC Uppsala AB Lines: 36 In-Reply-To: wht@n4hgf.Mt-Park.GA.US's message of 16 Aug 90 02:37:45 GMT In article <187@n4hgf.Mt-Park.GA.US> wht@n4hgf.Mt-Park.GA.US (Warren Tucker) writes: In article <27@astph.UUCP> jeff@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@uplog.se Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406 Box 1218 Fax: +46 18 132039 S - 751 42 Uppsala, Sweden