sem

Contains information about an individual semaphore.

Service:Synchronization

Structure

  #include <sys/sem.h>
  
  struct sem
  {
     ushort_t        semval;
     ushort_t        semadj;
     pid_t           sempid; 
     ushort_t        semncnt; 
     ushort_t        semzcnt; 
     void           *semptr; 
  };
  

Fields

semval

Specifies the semaphore value.

semadj

Specifies the last adjustment made to the semaphore. This field enables undo functionality.

sempid

Specifies the process ID of the last process that performed an operation with this semaphore.

semncnt

Specifies the number of processes waiting for the semaphore count to increase.

semzcnt

Specifies the number of processes waiting for the semaphore count to go to zero.

semptr

Reserved for internal use.

Remarks

The semid_ds structure contains an array of sem structures.