🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #902

semaphore semantics

#902
From: David F. Carlson
Date: Mon, 07 Nov 1988 19:31
20 lines
1375 bytes
A program of mine uses a unique semaphore for shared resource control.
Processes start and stop asynchronously and HAD been doing a 
semctl(..., IPC_RMID,...) to remove the ID on last close as one might do with
a lock file using the UNIX file system semantics.  The problem is that under
System V r3.0, the IPC_RMID doesn't wait until the last close but removes
the semaphore *immediately* AND all subsequent operations fail (correctly!!!)
with errno=ERMID.

This seems to violate other UNIX "shared-resources-that-are-removed"
conventions like unlink on last close.

As this appears to be how SV does things, how does one let the last process
remove the ID?  There appears to be no semctl that gives the number of active
processes like shmctl field shm_nattch.  Any shots would be appreciated.

-- 
David F. Carlson, Micropen, Inc.
micropen!dave@ee.rochester.edu

"The faster I go, the behinder I get." --Lewis Carroll
Technical Details
Message-ID: <579@micropen>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!bionet!apple!rutgers!mit-eddie!bbn!rochester!uhura.cc.rochester.edu!ur-valhalla!micropen!dave

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!bionet!apple!rutgers!mit-eddie!bbn!rochester!uhura.cc.rochester.edu!ur-valhalla!micropen!dave
From: dave@micropen (David F. Carlson)
Newsgroups: comp.bugs.sys5
Subject: semaphore semantics
Keywords: bug or not a bug
Message-ID: <579@micropen>
Date: 7 Nov 88 19:31:01 GMT
Organization: Micropen Dirent Writing Systems, Pittsford, NY
Lines: 19