For 32-bit Semaphore formats for other versions of OS/2 see:
Pointers
PTDA field pPrSemTbl points to the private semaphore table, which is indexed by the semaphore handle.
pShSemTbl points to the shared semaphore table, which is indexed by the low-order word of the semaphore handle. Each entry is a pointer to a semaphore main structre.
PTDA field pPrSemTbl points to the per-process private semaphore table, which is indexed by the low-order word of the semaphore handle. Each entry is a pointer to a semaphore main structre.
pShSemStrTbl points to the table of SEMTBLNODE entries. Each of these points to a hashed chain of SEMSTRNODE structures.
Note: Names are hashed by treating each name as table of null padded ULONGs and successively adding.
SEVENT
SEVENT Shared Event Semaphore
┌────────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐│Field Name │Off │Length │Type │Description │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usFlags │+0 │2 │W │attributes │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pMuxQ │+2 │4 │D │pointer to the mux queue │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usPostCt │+6 │2 │W │number of posts │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pOpenQ │+8 │4 │D │pointer to the open queue │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pszName │+c │4 │D │name of semaphore, null if anonymous │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pulCreatAddr │+10 │4 │D │Address passed in by app during create │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+14 │4 │D │0x54564553 "SEVT" │ ├────────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ptcb │+18 │4 │D │ptcb of caller │ └────────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
PEVENT Private Event Semaphore
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usFlags │+0 │2 │W │attributes │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pMuxQ │+2 │4 │D │pointer to the mux queue │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usPostCt │+6 │2 │W │number of posts │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pOpenCt │+8 │2 │W │number of opens │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pulCreatAddr │+a │4 │D │Address passed in by app during create │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+e │4 │D │0x54564550 "PEVT" │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
SMUTEX Shared Mutex Semaphore
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usFlags │+0 │2 │W │attributes │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pMuxQ │+2 │4 │D │pointer to the mux queue │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usRequestCt │+6 │2 │W │number of requests │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usSlotNum │+8 │2 │W │slot number of the owning thread │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usRequesterCt │+a │2 │W │number of requesters │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pOpenQ │+c │4 │D │pointer to the open queue │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pszName │+10 │4 │D │name of semaphore, null if anonymous │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pulCreatAddr │+14 │4 │D │Address passed in by app during create │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+18 │4 │D │0x58544D53 "SMTX" │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
PMUTEX Private Mutex Semaphore
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usFlags │+0 │2 │W │attributes │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pMuxQ │+2 │4 │D │pointer to the mux queue │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usRequestCt │+6 │2 │W │number of requests │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usSlotNum │+8 │2 │W │slot number of the owning thread │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usRequesterCt │+a │2 │W │number of requesters │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usOpenCt │+c │2 │W │number of opens │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pulCreatAddr │+e │4 │D │Address passed in by app during create │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+12 │4 │D │0x58544D50 "PMTX" │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
SMUX Shared Mux Wait Semaphore
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usFlags │+0 │2 │W │attributes │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │cSemRec │+2 │2 │W │count of semaphore records │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pSemRec │+4 │4 │D │array of semaphore record entries │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usWaitCt │+8 │2 │W │number of threads waiting on the mux │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pOpenQ │+a │4 │D │pointer to the open queue │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pszName │+e │2 │W │name of semaphore, null if anonymous │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pulCreatAddr │+10 │4 │D │Address passed in by app during create │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+14 │4 │D │0x58554D53 "SMUX" │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
PMUX Private Mux Wait Semaphore
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usFlags │+0 │2 │W │attributes │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │cSemRec │+2 │2 │W │count of semaphore records │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pSemRec │+4 │4 │D │array of semaphore record entries │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usWaitCt │+8 │2 │W │number of threads waiting on the mux │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usOpenCt │+a │2 │W │number of opens │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pPTDA │+c │4 │D │pointer to PTDA of creator │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pulCreatAddr │+10 │4 │D │Address passed in by app during create │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+14 │4 │D │0x58554D50 "PMUX" │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
OPENQ Open Queue Node Structure
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pidOpener │+0 │2 │W │process id of opening process │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │usOpenCt │+2 │2 │W │number of Opens for this process │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pNextOpen │+4 │4 │D │pointer to next node in list │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+8 │4 │D │0x514E504F "OPNQ" │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
MUXQ Mux Queue Node Structure
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pMux │+0 │4 │D │pointer to a mux (shared or private) │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │pNextMux │+4 │4 │D │pointer to next mux waiter in list │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulSig │+8 │4 │D │0x5158554D "MUXQ" │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
SEMRECORD Semaphore Record Structure for MUX Wait Semaphores.
┌──────────────────┬────────┬────────┬────────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type │Description │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │hsemCur │+0 │4 │D │semaphore handle │ ├──────────────────┼────────┼────────┼────────┼────────────────────────────────────────┤ │ulUser │+4 │4 │D │user value │ └──────────────────┴────────┴────────┴────────┴────────────────────────────────────────┘
SEMSTRNODE Semaphore String Node
┌──────────────────┬────┬────────┬────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type│Description │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │hsem │+0 │4 │D │semaphore handle │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │psz │+4 │4 │D │pointer to the string │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │pNext │+8 │4 │D │pointer to next string node │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │ulSig │+c │4 │D │0x444F4E53 "SNOD" │ └──────────────────┴────┴────────┴────┴────────────────────────────────────────┘
SEMTBLNODE Semaphore String Node Table Entry
┌──────────────────┬────┬────────┬────┬────────────────────────────────────────┐ │Field Name │Off │Length │Type│Description │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │ulKey │+0 │4 │D │hash key │ ├──────────────────┼────┼────────┼────┼────────────────────────────────────────┤ │pStrNode │+4 │4 │D │pointer to string node │ └──────────────────┴────┴────────┴────┴────────────────────────────────────────┘
usFlags field definitions:
┌─────────────┬────────┬────────────────────────────────────────┐ │Name │Bit Mask│Description │ ├─────────────┼────────┼────────────────────────────────────────┤ │DE_POSTED │0x0040 │The event sem APIs set this flag if the │ │ │ │event is in the posted state │ ├─────────────┼────────┼────────────────────────────────────────┤ │DM_OWNER_DIED│0x0080 │The process died while owning the mutex │ │ │ │semaphore │ ├─────────────┼────────┼────────────────────────────────────────┤ │DMW_MTX_MUX │0x0100 │The muxwait semaphore APIs set this flag│ │ │ │if the mux contains mutex sems │ ├─────────────┼────────┼────────────────────────────────────────┤ │DHO_SEM_OPEN │0x0200 │dh_OpenEventSem sets this flag to │ │ │ │indicate that device drivers have opened│ │ │ │the given semaphore │ ├─────────────┼────────┼────────────────────────────────────────┤ │DE_16BIT_MW │0x0400 │Part of a 16-bit MuxWait if this flag is│ │ │ │set │ └─────────────┴────────┴────────────────────────────────────────┘