shmat() & shmdt() questions.

BURNS,JIM gt0178a at prism.gatech.EDU
Sun Sep 16 22:17:58 AEST 1990


in article <1990Sep15.130415.28456 at virtech.uucp>, cpcahil at 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.90Sep14131954 at retix.retix.retix.com> jay at 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 at prism.gatech.edu



More information about the Comp.unix.internals mailing list