# sem - [Command Function](#section366714216619) - [Syntax](#section8833164614615) - [Parameters](#section12809111019453) - [Usage](#section15935131220717) - [Example](#section79281818476) - [Output](#section1975118519456) ## Command Function This command is used to query information about kernel semaphores. ## Syntax sem \[_ID__ / fulldata_\] ## Parameters **Table 1** Parameter description

Parameter

Parameters

Value Range

ID

Specifies the semaphore ID.

[0, 0xFFFFFFFF]

fulldata

Queries information about all the semaphores in use. The information to be printed includes SemID, Count, OriginalCount, Creater(TaskEntry), and LastAccessTime.

N/A

## Usage - If the parameters are not specified, this command displays the number of used semaphores and the total number of semaphores. - If the **ID** parameter is specified, semaphores of the specified ID are displayed. - The **fulldata** parameter depends on **LOSCFG\_DEBUG\_SEMAPHORE**. Before using this parameter, select **Enable Semaphore Debugging** on **menuconfig**. Debug ---\> Enable a Debug Version ---\> Enable Debug LiteOS Kernel Resource ---\> Enable Semaphore Debugging ## Example Run **sem fulldata**. ## Output **Figure 1** Querying information about all semaphores in use ![](figure/querying-information-about-all-semaphores-in-use.png "querying-information-about-all-semaphores-in-use") **Table 2** Output

Parameter

Description

SemID

Semaphore ID

Count

Number of used semaphores

>![](../public_sys-resources/icon-note.gif) **NOTE:** >The **ID** value can be in decimal or hexadecimal format. >When the **ID** value is within the range of \[0, 1023\], semaphore information of the specified ID is displayed. If the semaphore ID is not used, a message is displayed to inform you of this case. For other values, a message is displayed indicating that the parameter is incorrect.