Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.internals Subject: Re: shmat() & shmdt() questions. Message-ID: <1990Sep13.121704.24384@virtech.uucp> Date: 13 Sep 90 12:17:04 GMT References: <24482@adm.BRL.MIL> <13612@hydra.gatech.EDU> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 25 In article <13612@hydra.gatech.EDU> gt0178a@prism.gatech.EDU (BURNS,JIM) writes: > >> 2) can a child inherit the virtual address return by shmat()? >> for eg: >> shmid = shmget(..); >> addr = shmat(.shmid, (char *)0, 0); > >This is dangerous. The proper method is for the child to also do a >shmat(). On *some* OS's, the address returned by shmat() is the same in >all processes, but virtual OS's, (or even ones that play w/ the MMU) might >return different addresses, and the same address might mean different >things to different procs. This isn't dangerous. Once the shared memory segment is attached it is *supposed* to remain with the process (and therefore can move) even through forks. (since we are talking about a fork, we must be talking about the same kind of process and therefore there shouldn't be any difference between the two process (other than the return of fork) unless that vendor has broken something). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170