Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!sol.ctr.columbia.edu!emory!mephisto!prism!gt0178a From: gt0178a@prism.gatech.EDU (BURNS,JIM) Newsgroups: comp.unix.internals Subject: Re: shmat() & shmdt() questions. Message-ID: <13715@hydra.gatech.EDU> Date: 16 Sep 90 12:17:58 GMT References: <1990Sep15.130415.28456@virtech.uucp> Organization: Georgia Institute of Technology Lines: 39 in article <1990Sep15.130415.28456@virtech.uucp>, cpcahil@virtech.uucp (Conor P. Cahill) says: > I meant IPC_RMID. I don't know where that functionality (that the shared > memory segment will be marked for deletion, but not deleted until the > last reference (attachment) is removed) is documented, but it does > work that way. It's documented in (at least) the HP 9000/800 HP-UX Real Time Programmers Manual: "A process can detach the shared memory segment from its data space by calling shmdt(). The process should detach after it has finished accessing the shared memory segment. However, it is not necessary to explicitly detach the segment with shmdt() because the system will detach the segment as part of the process's exit code. "If a process performs a shmdt() and a shmctl(2) with IPC_RMID, it is not necessary to call shmdt() first. If shmctl(2) with IPC_RMID is called first, the system will not remove the shmid, segment or data structure until the last attached process has detached. However, no additional processes can attach to the segment." ex - "shmctl(myshmid, IPC_RMID, 0);", altho' actually shmctl(2) does have an int return code. I've also seen it in the SunOS man pages, altho' I have seen it omitted in other system's man pages. > In article jay@retix.retix.retix.com (Jay Logue) writes: >>This sounds to me like an added feature of your Un*x. The ability to >>have a "temporary" shared memory segment would be great but I don't >>think standard System V R3 provides this. I don't it's that there are "temporary" shm segs (there aren't) so much as its *use* is temporary. You have to explicitly remove a shm seg as above. -- BURNS,JIM Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332 uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a Internet: gt0178a@prism.gatech.edu