BPXYSEM — Map interprocess communication semaphores

DSECTs (SEMID_DS, SEM_ARRAY and SEM_BUF_ELE) will be generated with either DSECT=NO or DSECT=YES. If DSECT=NO is specified, you may need an additional DSECT / CSECT statement to return to the current DSECT or CSECT.

AMODE 64 callers use BPXYSEM — Map interprocess communication semaphores.

                                                      
            BPXYSEM    ,                                                        
** BPXYSEM: Interprocess Communications Permission                              
**  Used By: XSO, XSC                                                           
SEMID_DS             DSECT ,      semctl structure                              
SEM_PERM             DS    CL(IPC#LENGTH)   Mapped by BPXYIPCP                  
SEM_NSEMS            DS    H      number of semaphores in set                   
                     DS    H      spacer                                        
SEM_OTIME            DS    FL4    last semop() time                             
SEM_CTIME            DS    FL4    last time changed by semctl()                 
SEM#LENGTH           EQU   *-SEMID_DS   Length of this DSECT                    
* SETVAL - a one element array for Semaphore_Number                             
* SETALL, GETALL - an array with Number_of_Semaphore elements                   
SEM_ARRAY            DSECT ,      SETALL, GETALL, SETVAL                        
SEM_ARRAY_VAL        DS    FL2    semaphore value                               
SEM_BUF_ELE          DSECT ,      sembuf element - semop                        
SEM_NUM              DS    FL2    semaphore number (0 to n-1)                   
SEM_OP               DS    FL2    semaphore operation                           
SEM_FLG              DS    H      operation flags                               
SEM#BUFLEN           EQU   *-SEM_BUF_ELE                                        
* Flag bits - semop (also IPC_NOWAIT                                            
SEM_UNDO             EQU   2      Set up adjust on exit entry.                  
* Control Commands - (also IPC_RMID, IPC_SET, IPC_STAT):                        
SEM_GETVAL           EQU   21     Get the current semaphore value               
SEM_SETVAL           EQU   22     Change the semaphore value                    
SEM_GETPID           EQU   23     Get PID of last process to alter sem          
SEM_GETNCNT          EQU   24     Get count of tasks waiting for val>0          
SEM_GETZCNT          EQU   25     Get count of tasks waiting for val=0          
SEM_GETALL           EQU   26     Get the current semaphore values              
SEM_SETALL           EQU   27     Change the semaphore values                   
* Maximum and minimum values                                                    
SEM#MAX_VAL          EQU   32767  Maximum sem_val (min = 0)                     
SEM#MAX_ADJ          EQU   16383  Maximum sem_adj (min = -MAX)                  
** BPXYSEM End