Everything

ref_sem

iref_sem

Outline
Reference semaphore state.
C format
 ER      ref_sem (ID semid, T_RSEM *pk_rsem);
 ER      iref_sem (ID semid, T_RSEM *pk_rsem);
Parameter(s)
I/O
Parameter
Description
I
 ID      semid;
ID number of the semaphore to be referenced.
O
 T_RSEM  *pk_rsem;
Pointer to the packet returning the semaphore state.

[Semaphore state packet: T_RSEM]
 typedef struct  t_rsem {
     ID      wtskid;         /*Existence of waiting task*/
     UINT    semcnt;         /*Current resource count*/
     ATR     sematr;         /*Attribute*/
     UINT    maxsem;         /*Maximum resource count*/
 } T_RSEM;

Explanation
Stores semaphore state packet (ID number of the task at the head of the wait queue, current resource count, etc.) of the semaphore specified by parameter semid in the area specified by parameter pk_rsem.
Note For details about the semaphore state packet, refer to "15.2.3 Semaphore state packet".
Return value
Macro
Value
Description
E_OK
0
Normal completion.
E_ID
-18
Invalid ID number.
- semid < 0x0
- semid > Maximum ID number
E_CTX
-25
Context error.
- This service call was issued in the CPU locked state.
E_NOEXS
-42
Non-existent object.
- Specified semaphore is not registered.