From 566ae7d151f68c2d285fe4897e72c8d0452598fb Mon Sep 17 00:00:00 2001 From: annie_wangli Date: Sat, 12 Mar 2022 12:43:22 +0800 Subject: [PATCH 1/2] update docs Signed-off-by: annie_wangli --- .../kernel/kernel-basic-mini-time.md | 78 +-- .../kernel/kernel-mini-appx-lib-cmsis.md | 514 +++--------------- .../kernel/kernel-mini-basic-interrupt.md | 77 +-- .../kernel/kernel-mini-basic-task.md | 173 +----- 4 files changed, 154 insertions(+), 688 deletions(-) diff --git a/en/device-dev/kernel/kernel-basic-mini-time.md b/en/device-dev/kernel/kernel-basic-mini-time.md index eb5fd111c45..586349d0c46 100644 --- a/en/device-dev/kernel/kernel-basic-mini-time.md +++ b/en/device-dev/kernel/kernel-basic-mini-time.md @@ -1,13 +1,5 @@ # Time Management -- [Basic Concepts](#section36251149131120) -- [Time Unit](#section97172532397) -- [Available APIs](#section158501652121514) -- [How to Develop](#section783435801510) -- [Development Example](#section460018317164) - - [Example Description](#section127752801718) - - [Sample Code](#section321653551711) - - [Verification](#section4366193318167) ## Basic Concepts @@ -37,56 +29,18 @@ The following table describes APIs available for the OpenHarmony LiteOS-M time m **Table 1** APIs of the time management module - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function

-

API

-

Description

-

Time conversion

-

LOS_MS2Tick

-

Converts milliseconds into ticks.

-

LOS_Tick2MS

-

Converts ticks into milliseconds.

-

OsCpuTick2MS

-

Converts cycles into milliseconds. Two UINT32 values indicate the high-order and low-order 32 bits of the result value, respectively.

-

OsCpuTick2US

-

Converts cycles into microseconds. Two UINT32 values indicate the high-order and low-order 32 bits of the result value, respectively.

-

Time statistics

-

LOS_SysClockGet

-

Obtains the system clock.

-

LOS_TickCountGet

-

Obtains the number of ticks since the system starts.

-

LOS_CyclePerTickGet

-

Obtains the number of cycles for each tick.

-
+| Category| API| Description| +| -------- | -------- | -------- | +| Time conversion| LOS_MS2Tick | Converts milliseconds into ticks.| +| | LOS_Tick2MS | Converts ticks into milliseconds.| +| | OsCpuTick2MS | Converts cycles into milliseconds. Two UINT32 values indicate the high-order and low-order 32 bits of the result value, respectively.| +| | OsCpuTick2US | Converts cycles into microseconds. Two UINT32 values indicate the high-order and low-order 32 bits of the result value, respectively.| +| Time statistics| LOS_SysClockGet | Obtains the system clock.| +| | LOS_TickCountGet | Obtains the number of ticks since the system starts.| +| | LOS_CyclePerTickGet | Obtains the number of cycles for each tick.| +| | LOS_CurrNanosec |Obtains the number of nanoseconds since the system starts.| +| Delay management| LOS_UDelay |Performs busy waiting in μs, which can be preempted by a task with a higher priority.| +| | LOS_MDelay |Performs busy waiting in ms, which can be preempted by a task with a higher priority.| ## How to Develop @@ -95,7 +49,8 @@ The typical development process of time management is as follows: 1. Complete board configuration and adaptation as required, and configure the system clock frequency \(**OS\_SYS\_CLOCK** in Hz and **LOSCFG\_BASE\_CORE\_TICK\_PER\_SECOND**\). The default value of **OS\_SYS\_CLOCK** varies with the hardware platform. 2. Call the clock conversion and statistics APIs. ->![](../public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE** +> >- The time management module depends on **OS\_SYS\_CLOCK** and **LOSCFG\_BASE\_CORE\_TICK\_PER\_SECOND**. >- The number of system ticks is not counted when the interrupt feature is disabled. Therefore, the number of ticks cannot be used as the accurate time. >- The configuration options are maintained in the **target\_config.h** file of the development board project. @@ -106,8 +61,8 @@ The typical development process of time management is as follows: The following example describes basic time management methods, including: -1. Time conversion: convert milliseconds to ticks or convert ticks to milliseconds. -2. Time statistics: obtain the number of cycles per tick, number of ticks since system startup, and number of delayed ticks. +- Time conversion: convert milliseconds to ticks or convert ticks to milliseconds. +- Time statistics: obtain the number of cycles per tick, number of ticks since system startup, and number of delayed ticks. ### Sample Code @@ -175,4 +130,3 @@ LOS_CyclePerTickGet = 495000 LOS_TickCountGet = 1 LOS_TickCountGet after delay = 201 ``` - diff --git a/en/device-dev/kernel/kernel-mini-appx-lib-cmsis.md b/en/device-dev/kernel/kernel-mini-appx-lib-cmsis.md index faae4988fa7..e159dee8eff 100644 --- a/en/device-dev/kernel/kernel-mini-appx-lib-cmsis.md +++ b/en/device-dev/kernel/kernel-mini-appx-lib-cmsis.md @@ -19,437 +19,88 @@ The following table describes CMSIS-RTOS v2 APIs. For more details about the API **Table 1** CMSIS-RTOS v2 APIs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function

-

API

-

Description

-

Kernel information and control

-

osKernelGetInfo

-

Obtains RTOS kernel information.

-

osKernelGetState

-

Obtains the current RTOS kernel status.

-

osKernelGetSysTimerCount

-

Obtains the RTOS kernel system timer count.

-

osKernelGetSysTimerFreq

-

Obtains the RTOS kernel system timer frequency.

-

osKernelInitialize

-

Initializes the RTOS kernel.

-

osKernelLock

-

Locks the RTOS kernel scheduler.

-

osKernelUnlock

-

Unlocks the RTOS kernel scheduler.

-

osKernelRestoreLock

-

Restores the RTOS kernel scheduler to the locked state.

-

osKernelResume

-

Restores the RTOS kernel scheduler. (not implemented yet)

-

osKernelStart

-

Starts the RTOS kernel scheduler.

-

osKernelSuspend

-

Suspends the RTOS kernel scheduler. (not implemented yet)

-

osKernelGetTickCount

-

Obtains the RTOS kernel tick count.

-

osKernelGetTickFreq

-

Obtains the RTOS kernel tick frequency.

-

Thread management

-

osThreadDetach

-

Detaches a thread (thread storage can be reclaimed when the thread terminates). (not implemented yet)

-

osThreadEnumerate

-

Enumerates active threads. (not implemented yet)

-

osThreadExit

-

Terminates execution of the thread that is currently running.

-

osThreadGetCount

-

Obtains the number of active threads.

-

osThreadGetId

-

Returns the ID of the thread that is running.

-

osThreadGetName

-

Obtains the name of a thread.

-

osThreadGetPriority

-

Obtains the current priority of a thread.

-

osThreadGetStackSize

-

Obtains the stack size of a thread.

-

osThreadGetStackSpace

-

Obtains the available stack space of a thread based on the stack waterline record during execution.

-

osThreadGetState

-

Obtains the current status of a thread.

-

osThreadJoin

-

Waits for the specified thread to terminate. (not implemented yet)

-

osThreadNew

-

Creates a thread and add it to active threads.

-

osThreadResume

-

Resumes the execution of a thread.

-

osThreadSetPriority

-

Changes the priority of a thread.

-

osThreadSuspend

-

Suspends the execution of a thread.

-

osThreadTerminate

-

Terminates the execution of a thread.

-

osThreadYield

-

Passes control to the next thread in the ready state.

-

Thread flag

-

osThreadFlagsSet

-

Sets the specified thread flags for a thread. (not implemented yet)

-

osThreadFlagsClear

-

Clears the specified thread flags of the thread that is running. (not implemented yet)

-

osThreadFlagsGet

-

Obtains the current thread flags of the thread that is running. (not implemented yet)

-

osThreadFlagsWait

-

Waits for one or more thread flags of the currently running thread to emit a signal. (not implemented yet)

-

Event flag

-

osEventFlagsGetName

-

Obtains the name of an event flag object. (not implemented yet)

-

osEventFlagsNew

-

Creates and initializes an event flag object.

-

osEventFlagsDelete

-

Deletes an event flag object.

-

osEventFlagsSet

-

Sets the specified event flag.

-

osEventFlagsClear

-

Clears the specified event flag.

-

osEventFlagsGet

-

Obtains the current event flag.

-

osEventFlagsWait

-

Waits for one or more event flags to be signaled.

-

General wait function

-

osDelay

-

Waits for timeout (time delay).

-

osDelayUntil

-

Waits until the specified time.

-

Timer management

-

osTimerDelete

-

Deletes a timer.

-

osTimerGetName

-

Obtains the name of a timer. (not implemented yet)

-

osTimerIsRunning

-

Checks whether a timer is running.

-

osTimerNew

-

Creates and initializes a timer.

-

osTimerStart

-

Starts or restarts a timer.

-

osTimerStop

-

Stops a timer.

-

Mutex management

-

osMutexAcquire

-

Acquires a mutex or waits for timeout (if locked).

-

osMutexDelete

-

Deletes a mutex object.

-

osMutexGetName

-

Obtains the name of a mutex object. (not implemented yet)

-

osMutexGetOwner

-

Obtains the thread that has a mutex object.

-

osMutexNew

-

Creates and initializes a mutex object.

-

osMutexRelease

-

Releases the mutex obtained by calling osMutexAcquire.

-

Semaphore

-

osSemaphoreAcquire

-

Obtains a semaphore token or waits for timeout if no token is available.

-

osSemaphoreDelete

-

Deletes a semaphore object.

-

osSemaphoreGetCount

-

Obtains the number of tokens of the current semaphore.

-

osSemaphoreGetName

-

Obtains the name of a semaphore object. (not implemented yet)

-

osSemaphoreNew

-

Creates and initializes a semaphore object.

-

osSemaphoreRelease

-

Releases a semaphore token till the initial maximum count.

-

Memory pool

-

osMemoryPoolAlloc

-

Allocates a memory block from the memory pool.

-

osMemoryPoolDelete

-

Deletes a memory pool object.

-

osMemoryPoolFree

-

Releases the allocated memory block to the memory pool.

-

osMemoryPoolGetBlockSize

-

Obtains the memory block size in the memory pool.

-

osMemoryPoolGetCapacity

-

Obtains the maximum number of memory blocks in the memory pool.

-

osMemoryPoolGetCount

-

Obtains the number of memory blocks used in the memory pool.

-

osMemoryPoolGetName

-

Obtains the name of a memory pool object.

-

osMemoryPoolGetSpace

-

Obtains the number of available memory blocks in the memory pool.

-

osMemoryPoolNew

-

Creates and initializes a memory pool object.

-

Message queue

-

osMessageQueueDelete

-

Deletes a message queue object.

-

osMessageQueueGet

-

Obtains a message from the queue or waits for timeout if the queue is empty.

-

osMessageQueueGetCapacity

-

Obtains the maximum number of messages in a message queue.

-

osMessageQueueGetCount

-

Obtains the number of queued messages in a message queue.

-

osMessageQueueGetMsgSize

-

Obtains the maximum size of the message in the memory pool.

-

osMessageQueueGetName

-

Obtains the name of a message queue object. (not implemented yet)

-

osMessageQueueGetSpace

-

Obtains the number of available slots for messages in a message queue.

-

osMessageQueueNew

-

Creates and initializes a message queue object.

-

osMessageQueuePut

-

Puts the message into the queue or waits till timeout if the queue is full.

-

osMessageQueueReset

-

Resets the message queue to its initial empty state. (not implemented yet)

-
+| Category| API| Description| +| -------- | -------- | -------- | +| Kernel information and control| osKernelGetInfo | Obtains RTOS kernel information.| +| | osKernelGetState | Obtains the current RTOS kernel status.| +| | osKernelGetSysTimerCount | Obtains the RTOS kernel system timer count.| +| | osKernelGetSysTimerFreq | Obtains the RTOS kernel system timer frequency.| +| | osKernelInitialize | Initializes the RTOS kernel.| +| | osKernelLock | Locks the RTOS kernel scheduler.| +| | osKernelUnlock | Unlocks the RTOS kernel scheduler.| +| | osKernelRestoreLock | Restores the RTOS kernel scheduler to the locked state.| +| | osKernelResume | Restores the RTOS kernel scheduler (not implemented yet).| +| | osKernelStart | Starts the RTOS kernel scheduler.| +| | osKernelSuspend | Suspends the RTOS kernel scheduler (not implemented yet).| +| | osKernelGetTickCount | Obtains the RTOS kernel tick count.| +| | osKernelGetTickFreq | Obtains the RTOS kernel tick frequency.| +| Thread management| osThreadDetach | Detaches a thread (to reclaim the thread storage when the thread terminates).| +| | osThreadEnumerate | Enumerates active threads (not been implemented yet).| +| | osThreadExit | Terminates a running thread.| +| | osThreadGetCount | Obtains the number of active threads.| +| | osThreadGetId | Obtains the ID of the running thread.| +| | osThreadGetName | Obtains the thread name.| +| | osThreadGetPriority | Obtains the current thread priority.| +| | osThreadGetStackSize | Obtains the thread stack size.| +| | osThreadGetStackSpace | Obtains the available stack space for a thread based on the stack waterline record during execution.| +| | osThreadGetState | Obtains the current thread status.| +| | osThreadJoin | Waits for the specified thread to terminate.| +| | osThreadNew | Creates a thread and adds it to active threads.| +| | osThreadResume | Resumes the execution of a thread.| +| | osThreadSetPriority | Changes the priority of a thread.| +| | osThreadSuspend | Suspends a thread.| +| | osThreadTerminate | Terminates a thread.| +| | osThreadYield | Passes control to the next thread in the ready state.| +| Thread flag| osThreadFlagsSet | Sets flags for a thread.| +| | osThreadFlagsClear | Clears the specified flags for the running thread.| +| | osThreadFlagsGet | Obtains the current flags of the running thread.| +| | osThreadFlagsWait | Waits for one or more thread flags of the running thread to signal.| +| Event flag| osEventFlagsGetName | Obtains the names of the event flags (not implemented yet).| +| | osEventFlagsNew | Creates and initializes event flags.| +| | osEventFlagsDelete | Deletes event flags.| +| | osEventFlagsSet | Sets event flags.| +| | osEventFlagsClear | Clears event flags.| +| | osEventFlagsGet | Obtains the current event flags.| +| | osEventFlagsWait | Waits for one or more event flags to be signaled.| +| General waiting functions| osDelay | Waits for timeout (time delay).| +| | osDelayUntil | Waits until the specified time.| +| Timer management| osTimerDelete | Deletes a timer.| +| | osTimerGetName | Obtains the timer name (not implemented yet).| +| | osTimerIsRunning | Checks whether a timer is running.| +| | osTimerNew | Creates and initializes a timer.| +| | osTimerStart | Starts or restarts a timer.| +| | osTimerStop | Stops a timer.| +| Mutex management| osMutexAcquire | Acquires a mutex or times out (if locked).| +| | osMutexDelete | Deletes a mutex.| +| | osMutexGetName | Obtains the mutex name (not implemented yet).| +| | osMutexGetOwner | Obtains the thread that acquires the mutex.| +| | osMutexNew | Creates and initializes a mutex.| +| | osMutexRelease | Releases the mutex obtained using **osMutexAcquire**.| +| Semaphore| osSemaphoreAcquire | Obtains the semaphore token or times out if no token is available.| +| | osSemaphoreDelete | Deletes a semaphore.| +| | osSemaphoreGetCount | Obtains the token count of the current semaphore.| +| | osSemaphoreGetName | Obtains the name of a semaphore (not implemented yet).| +| | osSemaphoreNew | Creates and initializes a semaphore.| +| | osSemaphoreRelease | Releases semaphore tokens till the initial maximum count.| +| Memory pool| osMemoryPoolAlloc | Allocates a memory block from the memory pool.| +| | osMemoryPoolDelete | Deletes a memory pool object.| +| | osMemoryPoolFree | Releases the allocated memory block to the memory pool.| +| | osMemoryPoolGetBlockSize | Obtains the memory block size in the memory pool.| +| | osMemoryPoolGetCapacity | Obtains the maximum number of memory blocks in the memory pool.| +| | osMemoryPoolGetCount | Obtains the number of used memory blocks in the memory pool.| +| | osMemoryPoolGetName | Obtains the memory pool name.| +| | osMemoryPoolGetSpace | Obtains the number of available memory blocks in the memory pool.| +| | osMemoryPoolNew | Creates and initializes a memory pool.| +| Message queue| osMessageQueueDelete | Deletes a message queue.| +| | osMessageQueueGet | Obtain a message from the queue or times out if the queue is empty.| +| | osMessageQueueGetCapacity | Obtains the maximum number of messages in the message queue.| +| | osMessageQueueGetCount | Obtains the number of queued messages in the message queue.| +| | osMessageQueueGetMsgSize | Obtains the maximum message size in the memory pool.| +| | osMessageQueueGetName | Obtains the message queue name (not implemented yet).| +| | osMessageQueueGetSpace | Obtains the number of slots available for messages in the message queue.| +| | osMessageQueueNew | Creates and initializes a message queue.| +| | osMessageQueuePut | Puts the message into the queue or times out if the queue is full.| +| | osMessageQueueReset | Initialized the message queue to the empty state (not implemented yet).| ### How to Develop @@ -484,4 +135,3 @@ int main (void) { for (;;) {} } ``` - diff --git a/en/device-dev/kernel/kernel-mini-basic-interrupt.md b/en/device-dev/kernel/kernel-mini-basic-interrupt.md index 6429771d823..892ff1dd410 100644 --- a/en/device-dev/kernel/kernel-mini-basic-interrupt.md +++ b/en/device-dev/kernel/kernel-mini-basic-interrupt.md @@ -49,52 +49,24 @@ The following table describes APIs available for the OpenHarmony LiteOS-M interr **Table 1** APIs of the interrupt module - - - - - - - - - - - - - - - - - - - - - - - - -

Function

-

API

-

Description

-

Creating or deleting interrupts

-

HalHwiCreate

-

Creates an interrupt and registers the interrupt ID, interrupt triggering mode, interrupt priority, and interrupt handler. When an interrupt is triggered, the interrupt handler will be called.

-

HalHwiDelete

-

Deletes an interrupt based on the specified interrupt ID.

-

Enabling or disabling interrupts

-

LOS_IntUnLock

-

Enables the CPU to respond to all interrupt requests.

-

LOS_IntLock

-

Disables the CPU from responding to interrupt requests.

-

LOS_IntRestore

-

Restores the interrupt status before the LOS_IntLock and LOS_IntUnLock operations are performed.

-
+| Category| API| Description| +| -------- | -------- | -------- | +| Creating or deleting an interrupt| LOS_HwiCreate | Creates an interrupt and registers the interrupt ID, triggering mode, priority, and interrupt handler. When an interrupt is triggered, the interrupt handler will be called.| +| | LOS_HwiDelete | Deletes an interrupt based on the specified interrupt ID.| +| Locking or unlocking interrupts| LOS_IntUnLock | Enables the CPU to respond to all interrupt requests.| +| | LOS_IntLock | Disables the CPU from responding to interrupt requests.| +| | LOS_IntRestore | Restores the interrupt status before the **LOS_IntLock** and **LOS_IntUnLock** operations are performed.| +| Enabling or disabling an interrupt| LOS_HwiDisable | Disables the CPU from responding to the specified interrupt by setting the register.| +| | LOS_HwiEnable | Enables the CPU to respond to the specified interrupt by setting the register.| +| Setting the interrupt priority| LOS_HwiSetPriority | Sets the interrupt priority.| +| Triggering an interrupt| LOS_HwiTrigger | Triggers an interrupt (simulate an external interrupt by writing the related register of the interrupt controller).| +| Clearing interrupt register status| LOS_HwiClear | Clears the status bit of the interrupt register corresponding to the interrupt ID. The implementation of this API depends on the interrupt controller version. It is optional.| ## How to Develop -1. Create an interrupt by calling **HalHwiCreate**. -2. Call **TestHwiTrigger** to trigger the specified interrupt. \(This API is defined in the test suite. It simulates an external interrupt by writing the related register of the interrupt controller. Skip this step for common peripheral devices.\) -3. Call **HalHwiDelete** to delete the specified interrupt. Use this API based on actual requirements. +1. Call **LOS_HwiCreate** to create an interrupt. +2. Call **LOS_HwiTrigger** to trigger the interrupt. +3. Call **LOS_HwiDelete** to delete the specified interrupt. Use this API based on actual requirements. >![](../public_sys-resources/icon-note.gif) **NOTE:** >- Configure the maximum number of interrupts supported and the number of configurable interrupt priorities based on the specific hardware. @@ -131,9 +103,9 @@ static UINT32 Example_Interrupt(VOID) HwiIrqParam irqParam; (void)memset_s(&irqParam, sizeof(HwiIrqParam), 0, sizeof(HwiIrqParam)); irqParam.pDevId = 0; - + /* Create an interrupt. */ - ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiUsrIrq, &irqParam); + ret = LOS_HwiCreate(HWI_NUM_TEST, hwiPrio, mode, (HWI_PROC_FUNC)HwiUsrIrq, &irqParam); if(ret == LOS_OK){ printf("Hwi create success!\n"); } else { @@ -141,11 +113,17 @@ static UINT32 Example_Interrupt(VOID) return LOS_NOK; } - /* Delay 50 ticks. When a hardware interrupt occurs, the HwiUsrIrq function will be called. */ - LOS_TaskDelay(50); + /* Trigger the interrupt. */ + ret = LOS_HwiTrigger(HWI_NUM_TEST); + if(ret == LOS_OK){ + printf("Hwi trigger success!\n"); + } else { + printf("Hwi trigger failed!\n"); + return LOS_NOK; + } - /* Delete an interrupt. */ - ret = HalHwiDelete(HWI_NUM_TEST); + /* Delete the interrupt. */ + ret = LOS_HwiDelete(HWI_NUM_TEST); if(ret == LOS_OK){ printf("Hwi delete success!\n"); } else { @@ -164,4 +142,3 @@ The development is successful if the return result is as follows: Hwi create success! Hwi delete success! ``` - diff --git a/en/device-dev/kernel/kernel-mini-basic-task.md b/en/device-dev/kernel/kernel-mini-basic-task.md index 3087fd0aaa3..b2a566704c8 100644 --- a/en/device-dev/kernel/kernel-mini-basic-task.md +++ b/en/device-dev/kernel/kernel-mini-basic-task.md @@ -109,149 +109,35 @@ The following table describes APIs available for the OpenHarmony LiteOS-M task m **Table 1** APIs of the task management module - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function

-

API

-

Description

-

Creating or deleting a task

-

LOS_TaskCreateOnly

-

Creates a task and suspends the task to disable scheduling of the task. To enable scheduling of the task, call LOS_TaskResume to make the task enter the Ready state.

-

LOS_TaskCreate

-

Creates a task and places the task in the Ready state. If there is no task with a higher priority in the Ready queue, the task will be executed.

-

LOS_TaskDelete

-

Deletes the specified task.

-

Controlling task status

-

LOS_TaskResume

-

Resumes a suspended task to place the task in the Ready state.

-

LOS_TaskSuspend

-

Suspends the specified task and performs task switching.

-

LOS_TaskJoin

-

Suspends this task till the specified task is complete and the task control block resources are reclaimed.

-

LOS_TaskDelay

-

Makes a task wait for a period of time (in ticks) and releases CPU resources. When the delay time expires, the task enters the Ready state again. The input parameter is the number of ticks.

-

LOS_Msleep

-

Converts the input parameter number of milliseconds into number of ticks, and use the result to call LOS_TaskDelay.

-

LOS_TaskYield

-

Sets the time slice of the current task to 0 to release CPU resources and schedule the task with the highest priority in the Ready queue to run.

-

Control task scheduling

-

LOS_TaskLock

-

Locks task scheduling. However, tasks can still be interrupted.

-

LOS_TaskUnlock

-

Unlocks task scheduling.

-

LOS_Schedule

-

Triggers task scheduling

-

Controlling task priority

-

LOS_CurTaskPriSet

-

Sets the priority for the current task.

-

LOS_TaskPriSet

-

Sets the priority for a specified task.

-

LOS_TaskPriGet

-

Obtains the priority of a specified task.

-

Obtaining task information

-

LOS_CurTaskIDGet

-

Obtains the ID of the current task.

-

LOS_NextTaskIDGet

-

Obtains the ID of the task with the highest priority in the Ready queue.

-

LOS_NewTaskIDGet

-

Same as LOS_NextTaskIDGet.

-

LOS_CurTaskNameGet

-

Obtains the name of the current task.

-

LOS_TaskNameGet

-

Obtains the name of a specified task.

-

LOS_TaskStatusGet

-

Obtains the state of a specified task.

-

LOS_TaskInfoGet

-

Obtains information about a specified task, including the task state, priority, stack size, stack pointer (SP), task entry function, and used stack space.

-

LOS_TaskIsRunning

-

Checks whether the task module has started scheduling.

-

Maintaining and testing task information

-

LOS_TaskSwitchInfoGet

-

Obtains task switching information. The macro LOSCFG_BASE_CORE_EXC_TSK_SWITCH must be enabled.

-
+| Category| API| Description| +| -------- | -------- | -------- | +| Creating or deleting a task| LOS_TaskCreateOnly | Creates a task and suspends the task to disable scheduling of the task. To enable scheduling of the task, call **LOS_TaskResume** to make the task enter the Ready state.| +| | LOS_TaskCreate | Creates a task and places the task in the Ready state. If there is no task with a higher priority in the Ready queue, the task will be executed.| +| | LOS_TaskDelete | Deletes a task.| +| Controlling task status| LOS_TaskResume | Resumes a suspended task to place it in the Ready state.| +| | LOS_TaskSuspend | Suspends the specified task and performs task switching.| +| | LOS_TaskJoin | Suspends this task till the specified task is complete and the task control block resources are reclaimed.| +| | LOS_TaskDetach | Changes the task attribute from **joinable** to **detach**. After the task of the **detach** attribute is complete, the task control block resources will be automatically reclaimed.| +| | LOS_TaskDelay | Makes a task wait for a period of time (in ticks) and releases CPU resources. When the delay time expires, the task enters the Ready state again. The input parameter is the number of ticks.| +| | LOS_Msleep | Converts the input number of milliseconds into number of ticks, and use the result to call **LOS_TaskDelay**.| +| | LOS_TaskYield | Sets the time slice of the current task to **0** to release CPU resources and schedule the task with the highest priority in the Ready queue to run.| +| Controlling task scheduling| LOS_TaskLock | Locks task scheduling. However, tasks can still be interrupted.| +| | LOS_TaskUnlock | Unlocks task scheduling.| +| | LOS_Schedule | Triggers task scheduling| +| Controlling task priority| LOS_CurTaskPriSet | Sets the priority for the current task.| +| | LOS_TaskPriSet | Sets the priority for a specified task.| +| | LOS_TaskPriGet | Obtains the priority of a specified task.| +| Obtaining Job information| LOS_CurTaskIDGet | Obtains the ID of the current task.| +| | LOS_NextTaskIDGet | Obtains the ID of the task with the highest priority in the Ready queue.| +| | LOS_NewTaskIDGet | Same as **LOS_NextTaskIDGet**.| +| | LOS_CurTaskNameGet | Obtains the name of the current task.| +| | LOS_TaskNameGet | Obtains the name of a specified task.| +| | LOS_TaskStatusGet | Obtains the state of a specified task.| +| | LOS_TaskInfoGet | Obtains information about a specified task, including the task state, priority, stack size, stack pointer (SP), task entry function, and used stack space.| +| | LOS_TaskIsRunning | Checks whether the task module has started scheduling.| +| Updating task information| LOS_TaskSwitchInfoGet | Obtains task switching information. The macro **LOSCFG_BASE_CORE_EXC_TSK_SWITCH** must be enabled.| +| Reclaiming task stack resources| LOS_TaskResRecycle | Reclaims all task stack resources.| + ## How to Develop @@ -410,4 +296,3 @@ TaskHi LOS_TaskSuspend Success. TaskHi LOS_TaskResume Success. Join Example_TaskHi Success! ``` - -- Gitee From 48a538e54f88bee033f1c530901bd1904cce7f2e Mon Sep 17 00:00:00 2001 From: annie_wangli Date: Sat, 12 Mar 2022 16:23:29 +0800 Subject: [PATCH 2/2] update docs Signed-off-by: annie_wangli --- .../kernel/kernel-mini-appx-lib-posix.md | 1794 +++-------------- 1 file changed, 225 insertions(+), 1569 deletions(-) diff --git a/en/device-dev/kernel/kernel-mini-appx-lib-posix.md b/en/device-dev/kernel/kernel-mini-appx-lib-posix.md index ad017c0f5c1..2d6bedf2be7 100644 --- a/en/device-dev/kernel/kernel-mini-appx-lib-posix.md +++ b/en/device-dev/kernel/kernel-mini-appx-lib-posix.md @@ -17,1579 +17,236 @@ The OpenHarmony kernel uses the **musl libc** library and self-developed APIs **Table 1** Available APIs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Type

-

Header File

-

API

-

Description

-

process

-

#include <stdlib.h>

-

void abort(void);

-

Terminates the execution of a thread.

-

#include <assert.h>

-

void assert(scalar expression);

-

Terminates the thread if the assertion is false.

-

#include <pthread.h>

-

int pthread_cond_destroy(pthread_cond_t *cond);

-

Destroys a condition variable.

-

#include <pthread.h>

-

int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr);

-

Initializes a condition variable.

-

#include <pthread.h>

-

int pthread_cond_timedwait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime);

-

Waits for the condition.

-

#include <pthread.h>

-

int pthread_condattr_init(pthread_condattr_t *attr);

-

Initializes a condition variable attribute object.

-

#include <pthread.h>

-

int pthread_mutex_unlock(pthread_mutex_t *mutex);

-

Unlocks a mutex.

-

#include <pthread.h>

-

int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);

-

Creates a thread.

-

#include <pthread.h>

-

int pthread_join(pthread_t thread, void **retval);

-

Waits for a thread to terminate.

-

#include <pthread.h>

-

pthread_t pthread_self(void);

-

Obtains the ID of the current thread.

-

#include <pthread.h>

-

int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param);

-

Obtains the scheduling policy and parameters of a thread.

-

#include <pthread.h>

-

int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param);

-

Sets a scheduling policy and parameters for a thread.

-

#include <pthread.h>

-

int pthread_mutex_init(pthread_mutex_t *__restrict m, const pthread_mutexattr_t *__restrict a);

-

Initializes a mutex.

-

#include <pthread.h>

-

int pthread_mutex_lock(pthread_mutex_t *m);

-

Locks a mutex.

-

#include <pthread.h>

-

int pthread_mutex_trylock(pthread_mutex_t *m);

-

Attempts to lock a mutex.

-

#include <pthread.h>

-

int pthread_mutex_destroy(pthread_mutex_t *m);

-

Destroys a mutex.

-

#include <pthread.h>

-

int pthread_attr_init(pthread_attr_t *attr);

-

Initializes a thread attribute object.

-

#include <pthread.h>

-

int pthread_attr_destroy(pthread_attr_t *attr);

-

Destroys a thread attribute object.

-

#include <pthread.h>

-

int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize);

-

Obtains the stack size of a thread attribute object.

-

#include <pthread.h>

-

int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);

-

Sets the stack size for a thread attribute object.

-

#include <pthread.h>

-

int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param);

-

Obtains scheduling parameter attributes of a thread attribute object.

-

#include <pthread.h>

-

int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param);

-

Sets scheduling parameter attributes for a thread attribute object.

-

#include <pthread.h>

-

int pthread_getname_np(pthread_t pthread, char *name, size_t len);

-

Obtains the name of a thread.

-

#include <pthread.h>

-

int pthread_setname_np(pthread_t pthread, const char *name);

-

Sets the thread name.

-

#include <pthread.h>

-

int pthread_cond_broadcast(pthread_cond_t *c);

-

Unblocks the threads that are currently blocked on the condition variable.

-

#include <pthread.h>

-

int pthread_cond_signal(pthread_cond_t *c);

-

Unblocks a thread.

-

#include <pthread.h>

-

int pthread_cond_wait(pthread_cond_t *__restrict c, pthread_mutex_t *__restrict m);

-

Waits for the condition.

-

fs

-

-

#include <libgen.h>

-

char *dirname(char *path);

-

Obtains the folder name.

-

#include <dirent.h>

-

struct dirent *readdir(DIR *dirp);

-

Reads a directory.

-

#include <sys/stat.h>

-

int stat(const char *restrict path, struct stat *restrict buf);

-

Obtains file information.

-

#include <unistd.h>

-

int unlink(const char *pathname);

-

Deletes a file.

-

#include <fcntl.h

-

int open(const char *path, int oflags, ...);

-

Opens a file. If the file does not exist, create a file and open it.

-

#include <nistd.h>

-

int close(int fd);

-

Closes a file.

-

#include <stdio.h>

-

int rename(const char *oldpath, const char *newpath);

-

Renames the specified file.

-

#include <dirent.h>

-

DIR *opendir(const char *dirname);

-

Opens the specified directory.

-

#include <dirent.h>

-

int closedir(DIR *dir);

-

Closes the specified directory.

-

#include <sys/mount.h>

-

int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data);

-

Mounts a file system.

-

#include <sys/mount.h>

-

int umount(const char *target);

-

Unmounts a file system.

-

#include <sys/mount.h>

-

int umount2(const char *target, int flag);

-

Unmounts a file system.

-

#include <sys/stat.h>

-

int fsync(int fd);

-

Synchronizes the files associated with a specified file descriptor to a storage device.

-

#include <sys/stat.h>

-

int mkdir(const char *pathname, mode_t mode);

-

Creates a directory.

-

#include <unistd.h>

-

int rmdir(const char *path);

-

Deletes a directory.

-

#include <sys/stat.h>

-

int fstat(int fd, struct stat *buf);

-

Obtains file status information.

-

#include <sys/statfs.h>

-

int statfs(const char *path, struct statfs *buf);

-

Obtains the file system information of a file in the specified path.

-

time

-

#include <sys/time.h>

-

int gettimeofday(struct timeval *tv, struct timezone *tz);

-

Obtains the time. Time zone is not supported. The return value of tz is empty.

-

#include <time.h>

-

struct tm *gmtime(const time_t *timep);

-

Converts a date and time to broken-down time or ASCII.

-

#include <time.h>

-

struct tm *localtime(const time_t *timep);

-

Obtains the time.

-

#include <time.h>

-

struct tm *localtime_r(const time_t *timep, struct tm *result);

-

Obtains the time.

-

#include <time.h>

-

time_t mktime(struct tm *tm);

-

Converts a date and time to broken-down time or ASCII.

-

#include <time.h>

-

size_t strftime(char *s, size_t max, const char *format,const struct tm *tm);

-

Formats the date and time string.

-

#include <time.h>

-

time_t time(time_t *tloc);

-

Obtains the calendar time.

-

#include <sys/times.h>

-

clock_t times(struct tms *buf);

-

Obtains the thread time.

-

#include <unistd.h>

-

int usleep(useconds_t usec);

-

Goes to hibernation (in μs).

-

#include <time.h>

-

int nanosleep(const struct timespec *tspec1, struct timespec *tspec2);

-

Pauses the calling thread till the specified time.

-

#include <time.h>

-

int clock_gettime(clockid_t id, struct timespec *tspec);

-

Obtains the clock time.

-

#include <time.h>

-

int timer_create(clockid_t id, struct sigevent *__restrict evp, timer_t *__restrict t);

-

Creates a timer for a thread.

-

#include <time.h>

-

int timer_delete(timer_t t);

-

Deletes a thread timer.

-

#include <time.h>

-

int timer_settime(timer_t t, int flags, const struct itimerspec *__restrict val, struct itimerspec *__restrict old);

-

Sets a timer for a thread.

-

#include <time.h>

-

time_t time (time_t *t);

-

Obtains the time.

-

#include <time.h>

-

char *strptime(const char *s, const char *format, struct tm *tm);

-

Converts the time string into the time tm structure.

-

util

-

#include <stdlib.h>

-

int atoi(const char *nptr);

-

Converts the character string into an integer (int).

-

#include <stdlib.h>

-

long atol(const char *nptr);

-

Converts the character string into an integer (long).

-

#include <stdlib.h>

-

long long atoll(const char *nptr);

-

Converts the character string into an integer (long long).

-

#include <ctype.h>

-

int isalnum(int c);

-

Checks for alphanumeric characters.

-

#include <ctype.h>

-

int isascii(int c);

-

Checks for ASCII.

-

#include <ctype.h>

-

int isdigit(int c);

-

Checks for numeric characters.

-

#include <ctype.h>

-

int islower(int c);

-

Checks for lowercase letters.

-

#include <ctype.h>

-

int isprint(int c);

-

Checks for printable characters, including spaces.

-

#include <ctype.h>

-

int isspace(int c);

-

Checks for a space.

-

#include <ctype.h>

-

int isupper(int c);

-

Checks for uppercase letters.

-

#include <ctype.h>

-

int isxdigit(int c);

-

Checks for hexadecimal digits.

-

#include <stdlib.h>

-

long int random (void);

-

Generates a random number.

-

#include <stdlib.h>

-

void srandom(unsigned int seed);

-

Initializes the random number generator.

-

#include <ctype.h>

-

int tolower(int c);

-

Converts letters to lowercase letters.

-

#include <ctype.h>

-

int toupper(int c);

-

Converts letters to uppercase letters.

-

#include <stdarg.h>

-

type va_arg(va_list ap, type);

-

Obtains the current parameter of a variable parameter, returns the value of the specified type, and moves the pointer to the next parameter.

-

#include <stdarg.h>

-

void va_copy(va_list dest, va_list src);

-

Copies parameters.

-

#include <stdarg.h>

-

void va_end(va_list ap);

-

Clears the va_list variable parameter list.

-

#include <stdarg.h>

-

void va_start(va_list ap, last);

-

Defines the start position of the variable-length parameter list.

-

#include <string.h>

-

char *strchr(const char *s, int c);

-

Locates the last occurrence of a character in a string.

-

#include <string.h>

-

int strcmp(const char *s1, const char *s2);

-

Compares strings.

-

#include <string.h>

-

size_t strcspn(const char *s, const char *reject);

-

Obtains the length of the initial segment of a string.

-

#include <string.h>

-

char *strdup(const char *s);

-

Copies a string to a new position.

-

#include <string.h>

-

size_t strlen(const char *s);

-

Calculates the length of a string.

-

#include <strings.h>

-

int strncasecmp(const char *s1, const char *s2, size_t n);

-

Compares fixed-length strings (case-insensitive).

-

#include <strings.h>

-

int strcasecmp(const char *s1, const char *s2);

-

Compares strings (case-insensitive).

-

#include <string.h>

-

int strncmp(const char *s1, const char *s2, size_t n);

-

Compares strings of the specified length.

-

#include <string.h>

-

char *strrchr(const char *s, int c);

-

Locates the last occurrence of a character in a string.

-

#include <string.h>

-

char *strstr(const char *haystack, const char *needle);

-

Searches for the specified string needle.

-

#include <stdlib.h>

-

long int strtol(const char *nptr, char **endptr, int base);

-

Converts a string into a long int value.

-

#include <stdlib.h>

-

unsigned long int strtoul(const char *nptr, char **endptr, int base);

-

Converts a string into an unsigned long int value.

-

#include <stdlib.h>

-

unsigned long long int strtoull(const char *nptr, char **endptr,int base);

-

Converts a string into an unsigned long long int value.

-

#include <regex.h>

-

int regcomp(regex_t *preg, const char *regex, int cflags);

-

Compiles a regular expression.

-

#include <regex.h>

-

int regexec(const regex_t *preg, const char *string, size_t nmatch,regmatch_t pmatch[], int eflags);

-

Matches a regular expression.

-

#include <regex.h>

-

void regfree(regex_t *preg);

-

Releases a regular expression.

-

#include <string.h>

-

char *strerror(int errnum);

-

Returns an error description string of the specified error code.

-

math

-

#include <stdlib.h>

-

int abs(int i);

-

Returns the absolute value.

-

#include <math.h>

-

double log(double x);

-

Returns the natural logarithm (base-e logarithm) of x.

-

#include <math.h>

-

double pow(double x, double y);

-

Returns x raised to the power of y.

-

#include <math.h>

-

double round(double x);

-

Rounds off the value from zero to the nearest integer.

-

#include <math.h>

-

double sqrt(double x);

-

Returns the square root of x.

-

IO

-

#include <stdio.h>

-

void clearerr(FILE *stream);

-

Clears the file end and error indication of a stream.

-

#include <stdio.h>

-

int fclose(FILE *stream);

-

Closes a file stream.

-

#include <stdio.h>

-

FILE *fdopen(int fd, const char *mode);

-

Opens a file stream by using a file descriptor.

-

#include <stdio.h>

-

int feof(FILE *stream);

-

Tests the end-of-file indicator for the specified stream.

-

#include <stdio.h>

-

int fflush(FILE *stream);

-

Refreshes a stream.

-

#include <stdio.h>

-

char *fgets(char *s, int size, FILE *stream);

-

Reads the next line of the stream.

-

#include <stdio.h>

-

int fileno(FILE *stream);

-

Returns the file descriptor of a stream.

-

#include <stdio.h>

-

FILE *fopen(const char *path, const char *mode);

-

Opens a stream.

-

#include <stdio.h>

-

int fputs(const char *s, FILE *stream);

-

Writes a line to a specified stream.

-

#include <stdio.h>

-

size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);

-

Reads a stream.

-

#include <stdio.h>

-

int fseek(FILE *stream, long offset, int whence);

-

Sets the position of a stream pointer.

-

#include <stdio.h>

-

long ftell(FILE *stream);

-

Obtains the position of a stream pointer.

-

#include <stdio.h>

-

size_t fwrite(const void *ptr, size_t size, size_t nmemb,FILE *stream);

-

Writes data to a stream.

-

#include <stdio.h>

-

void perror(const char *s);

-

Prints system error information.

-

#include <stdio.h>

-

void rewind(FILE *stream);

-

Re-positions a stream.

-

#include <unistd.h>

-

ssize_t write(int fd, const void *buf, size_t size);

-

Writes data to a file.

-

#include <unistd.h>

-

ssize_t read(int fd, void *buf, size_t size);

-

Reads data from a file.

-

net

-

#include <sys/socket.h>

-

void freeaddrinfo(struct addrinfo *res);

-

Releases the dynamic memory allocated by calling getaddrinfo.

-

#include <sys/socket.h>

-

int getaddrinfo(const char *restrict nodename,const char *restrict servname,const struct addrinfo *restrict hints,struct addrinfo **restrict res);

-

Performs network address translation.

-

#include <sys/socket.h>

-

int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,char *restrict node, socklen_t nodelen, char *restrict service,socklen_t servicelen, int flags);

-

Performs address-to-name translation in a protocol-independent manner.

-

#include <net/if.h>

-

unsigned int if_nametoindex(const char *ifname);

-

Obtains the index based on the network interface name.

-

#include <arpa/inet.h>

-

in_addr_t inet_addr(const char *cp);

-

Converts the network host address from dotted decimal notation to binary format.

-

#include <arpa/inet.h>

-

char *inet_ntoa(struct in_addr in);

-

Converts the network host address from binary format to dotted decimal notation.

-

#include <arpa/inet.h>

-

const char *inet_ntop(int af, const void *src,char *dst, socklen_t size);

-

Performs network address translation.

-

#include <arpa/inet.h>

-

int inet_pton(int af, const char *src, void *dst);

-

Performs network address translation.

-

#include <sys/socket.h>

-

int listen(int sockfd, int backlog);

-

Listens for sockets.

-

#include <sys/socket.h>

-

ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);

-

Receives a message from a socket. Note that the IOV size can be 1 only, and the ancillary message is not supported.

-

#include <sys/socket.h>

-

ssize_t send(int sockfd, const void *buf, size_t len, int flags);

-

Sends messages from a socket.

-

#include <sys/socket.h>

-

ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);

-

Sends messages from a socket. Ancillary messages are not supported.

-

#include <sys/socket.h>

-

ssize_t sendto(int sockfd, const void *buf, size_t len, int flags,const struct sockaddr *dest_addr, socklen_t addrlen);

-

Sends messages from a socket.

-

#include <sys/socket.h>

-

int setsockopt(int sockfd, int level, int optname,const void *optval, socklen_t optlen);

-

Sets the options associated with a socket.

-

mem

-

#include <string.h>

-

int memcmp(const void *s1, const void *s2, size_t n);

-

Compares memory areas.

-

#include <string.h>

-

void *memcpy(void *dest, const void *src, size_t n);

-

Copies memory content.

-

#include <string.h>

-

void *memset(void *s, int c, size_t n);

-

Initializes memory.

-

#include <stdlib.h>

-

void *realloc(void *ptr, size_t size);

-

Reallocates memory.

-

#include <stdlib.h>

-

void *malloc(size_t size);

-

Dynamically allocates memory blocks.

-

#include <stdlib.h>

-

void free(void *ptr);

-

Releases the memory space to which the PTR pointer points.

-

IPC

-

#include <semaphore.h>

-

int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);

-

Locks a semaphore for a specified period of time.

-

#include <semaphore.h>

-

int sem_destroy(sem_t *sem);

-

Destroys a specified anonymous semaphore.

-

#include <semaphore.h>

-

int sem_init(sem_t *sem, int pshared, unsigned int value);

-

Creates and initializes an anonymous semaphore.

-

#include <semaphore.h>

-

int sem_post(sem_t *sem);

-

Increments the semaphore count.

-

#include <semaphore.h>

-

int sem_wait(sem_t *sem);

-

Obtains the semaphore.

-

#include <mqueue.h>

-

mqd_t mq_open(const char *mqName, int openFlag, ...);

-

Opens an existing message queue with the specified name or creates a message queue.

-

#include <mqueue.h>

-

int mq_close(mqd_t personal);

-

Closes the message queue with the specified descriptor.

-

#include <mqueue.h>

-

int mq_unlink(const char *mqName);

-

Deletes a specified message queue.

-

#include <mqueue.h>

-

int mq_send(mqd_t personal, const char *msg, size_t msgLen, unsigned int msgPrio);

-

Puts a message with the specified content and length into a message queue with the specified descriptor.

-

#include <mqueue.h>

-

ssize_t mq_receive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio);

-

Deletes the oldest message from the message queue with the specified descriptor and places it in the buffer pointed to by msg_ptr.

-

#include <mqueue.h>

-

int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int msgPrio, const struct timespec *absTimeout)

-

Puts a message with the specified content and length into a message queue identified by the specified descriptor within specified time.

-

#include <mqueue.h>

-

ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio, const struct timespec *absTimeout);

-

Obtains a message with the specified content and length from a message queue specified by the descriptor.

-

#include <mqueue.h>

-

int mq_setattr(mqd_t mqdes, const struct mq_attr *__restrict newattr, struct mq_attr *__restrict oldattr);

-

Sets the attributes of the message queue specified by the descriptor.

-

version

-

#include <libc.h>

-

const char *libc_get_version_string(void);

-

Obtains the libc version string.

-

#include <libc.h>

-

int libc_get_version(void);

-

Obtains the libc version.

-
+| Category| Header File| API| Description| +| -------- | -------- | -------- | -------- | +| process | #include | void abort(void); | Terminates the thread.| +| | #include | void assert(scalar expression); | Terminates the thread if the assertion is false.| +| | #include | int pthread_cond_destroy(pthread_cond_t *cond); | Destroys a condition variable.| +| | #include | int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr); | Initializes a condition variable.| +| | #include | int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *shared); | Obtains condition variable attributes. Currently, only the attributes of **PTHREAD_PROCESS_PRIVATE** can be obtained.| +| | #include | int pthread_condattr_setpshared(pthread_condattr_t *attr, int shared); | Sets a condition variable attribute.| +| | #include | int pthread_condattr_getclock(const pthread_condattr_t *attr, clockid_t *clock); | Obtains the thread clock.| +| | #include | int pthread_condattr_destroy(pthread_condattr_t *attr); | Destroys a condition variable and invalidates the attribute object.| +| | #include | int pthread_cond_timedwait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime); | Waits for the condition.| +| | #include | int pthread_condattr_init(pthread_condattr_t *attr); | Initializes the condition variable attribute.| +| | #include | int pthread_mutex_unlock(pthread_mutex_t *mutex); | Unlocks a mutex.| +| | #include | int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); | Creates a thread.| +| | #include | int pthread_join(pthread_t thread, void **retval); | Waits for a thread to terminate.| +| | #include | pthread_t pthread_self(void); | Obtains the ID of the current thread.| +| | #include | int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param); | Obtains the scheduling policy and parameters of a thread.| +| | #include | int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param); | Sets a scheduling policy and parameters for a thread.| +| | #include | int pthread_setschedprio(pthread_t thread, int prio); | Sets the thread priority.| +| | #include | int pthread_once(pthread_once_t *onceControl, void (*initRoutine)(void)); | Performs one-time initialization routine.| +| | #include | int pthread_setcancelstate(int state, int *oldState); | Sets the cancel switch for the thread.| +| | #include | int pthread_setcanceltype(int type, int *oldType); | Sets the thread cancel type.| +| | #include | int pthread_cancel(pthread_t thread); | Cancels a thread. Currently, a thread can be cancelled only by setting the **PTHREAD_CANCEL_ASYNCHRONOUS** status and then calling **pthread_cancel**.| +| | #include | void pthread_testcancel(void); | Cancels this thread.| +| | #include | int pthread_equal(pthread_t thread1, pthread_t thread2); | Checks whether the two thread IDs are equal.| +| | #include | int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *outType); | Obtains the mutex type attribute.| +| | #include | int pthread_mutex_init(pthread_mutex_t *__restrict m, const pthread_mutexattr_t *__restrict a); | Initializes a mutex.| +| | #include | int pthread_mutex_lock(pthread_mutex_t *m); | Locks a mutex.| +| | #include | int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *absTimeout); | Requests a mutex (blocked only within the specified period).| +| | #include | int pthread_mutex_trylock(pthread_mutex_t *m); | Attempts to lock a mutex.| +| | #include | int pthread_mutex_destroy(pthread_mutex_t *m); | Destroys a mutex.| +| | #include | int pthread_attr_init(pthread_attr_t *attr); | Initializes a thread attribute object.| +| | #include | int pthread_attr_destroy(pthread_attr_t *attr); | Destroys a thread attribute object.| +| | #include | int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize); | Obtains the stack size of a thread attribute object.| +| | #include | int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); | Sets the stack size for a thread attribute object.| +| | #include | int pthread_attr_setstack(pthread_attr_t *attr, void *stackAddr, size_t stackSize); | Sets the stack attribute for a thread attribute object (not implemented yet).| +| | #include | int pthread_attr_getstack(const pthread_attr_t *attr, void **stackAddr, size_t *stackSize); | Obtains the stack of a thread attribute object (not implemented yet).| +| | #include | int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param); | Obtains scheduling parameter attributes of a thread attribute object.| +| | #include | int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param); | Sets scheduling parameter attributes for a thread attribute object.| +| | #include | int pthread_getname_np(pthread_t pthread, char *name, size_t len); | Obtains the thread name.| +| | #include | int pthread_setname_np(pthread_t pthread, const char *name); | Sets the thread name.| +| | #include | int pthread_cond_broadcast(pthread_cond_t *c); | Unblocks all threads that are currently blocked on the condition variable **cond**.| +| | #include | int pthread_cond_signal(pthread_cond_t *c); | Unblocks a thread.| +| | #include | int pthread_cond_wait(pthread_cond_t *__restrict c, pthread_mutex_t *__restrict m); | Waits for the condition.| +| fs | #include | char *dirname(char *path); | Obtains the directory name.| +| | #include | struct dirent *readdir(DIR *dirp); | Reads a directory.| +| | #include | int stat(const char *restrict path, struct stat *restrict buf); | Obtains file information.| +| | #include | int unlink(const char *pathname); | Deletes a file.| +| | #include | int close(int fd); | Closes a file.| +| | #include | int rename(const char *oldpath, const char *newpath); | Renames a file.| +| | #include | DIR *opendir(const char *dirname); | Opens the specified directory.| +| | #include | int closedir(DIR *dir); | Closes the specified directory.| +| | #include | int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); | Mounts a file system.| +| | #include | int umount(const char *target); | Unmounts a file system.| +| | #include | int umount2(const char *target, int flag); | Unmounts a file system.| +| | #include | int fsync(int fd); | Synchronizes the file associated with the specified file descriptor to the storage device.| +| | #include | int mkdir(const char *pathname, mode_t mode); | Creates a directory.| +| | #include | int rmdir(const char *path); | Deletes a directory.| +| | #include | int fstat(int fd, struct stat *buf); | Obtains file status.| +| | #include | int statfs(const char *path, struct statfs *buf); | Obtains the file system information for a file in a specified path.| +| time | #include | int gettimeofday(struct timeval *tv, struct timezone *tz); | Obtains the time. Currently, time zone is not supported, and the return value of **tz** is empty.| +| | #include | struct tm *gmtime(const time_t *timep); | Converts the date and time to broken-down time or ASCII.| +| | #include | struct tm *localtime(const time_t *timep); | Obtains the local time.| +| | #include | struct tm *localtime_r(const time_t *timep, struct tm *result); | Obtains the local time.| +| | #include | time_t mktime(struct tm *tm); | Converts the date and time to broken-down time or ASCII.| +| | #include | size_t strftime(char *s, size_t max, const char *format,const struct tm *tm); | Formats the date and time.| +| | #include | time_t time(time_t *tloc); | Obtains the calendar time.| +| | #include | clock_t times(struct tms *buf); | Obtains the thread time.| +| | #include | int timer_getoverrun(timer_t timerID); | Obtains the number of timer timeout times.| +| | #include | int usleep(useconds_t usec); | Goes to hibernation, in microseconds.| +| | #include | int nanosleep(const struct timespec *tspec1, struct timespec *tspec2); | Suspends the current thread till the specified time.| +| | #include | int clock_gettime(clockid_t id, struct timespec *tspec); | Obtains the clock time.| +| | #include | int timer_create(clockid_t id, struct sigevent *__restrict evp, timer_t *__restrict t); | Creates a timer for a thread.| +| | #include | int timer_delete(timer_t t); | Deletes the timer for a thread.| +| | #include | int timer_settime(timer_t t, int flags, const struct itimerspec *__restrict val, struct itimerspec *__restrict old); | Sets a timer for a thread.| +| | #include | time_t time (time_t *t); | Obtains the time.| +| | #include | char *strptime(const char *s, const char *format, struct tm *tm); | Converts the time string into the time **tm** structure.| +| util | #include | int atoi(const char *nptr); | Converts the string pointed to by **nptr** into an integer (**int** type).| +| | #include | long atol(const char *nptr); | Converts the string pointed to by **nptr** into a long Integer (**long** type).| +| | #include | long long atoll(const char *nptr); | Converts the string pointed to by **nptr** into a long long Integer (**long long** type).| +| | #include | int isalnum(int c); | Checks whether the passed character is alphanumeric.| +| | #include | int isascii(int c); | Checks whether the passed character is an ASCII character.| +| | #include | int isdigit(int c); | Checks whether the passed character is a digit.| +| | #include | int islower(int c); | Checks whether the passed character is in lowercase.| +| | #include | int isprint(int c); | Checks whether the passed character is printable, including spaces.| +| | #include | int isspace(int c); | Checks whether the passed character is a white-space character.| +| | #include | int isupper(int c); | Checks whether the passed character is in uppercase.| +| | #include | int isxdigit(int c); | Checks whether the passed character is a hexadecimal number.| +| | #include | long int random (void); | Generates a pseudo-random number.| +| | #include | void srandom(unsigned int seed); | Initializes the random number generator.| +| | #include | int tolower(int c); | Converts the given letter to lowercase.| +| | #include | int toupper(int c); | Converts the given letter to uppercase.| +| | #include | type va_arg(va_list ap, type); | Retrieves the next argument in the parameter list with **type**. | +| | #include | void va_copy(va_list dest, va_list src); | Copies parameters.| +| | #include | void va_end(va_list ap); | Clears the variable list.| +| | #include | void va_start(va_list ap, last); | Defines the beginning of the list of variable arguments.| +| | #include | char *strchr(const char *s, int c); | Searches for the first occurrence of a character in a string.| +| | #include | int strcmp(const char *s1, const char *s2); | Compares two strings.| +| | #include | size_t strcspn(const char *s, const char *reject); | Obtains the length of the initial segment of the string **s** which does not contain any of bytes in the string **reject**.| +| | #include | char *strdup(const char *s); | Copies a string to a new position.| +| | #include | size_t strlen(const char *s); | Obtains the length of a string.| +| | #include | int strncasecmp(const char *s1, const char *s2, size_t n); | Compares the bytes of the specified length in two strings, ignoring case.| +| | #include | int strcasecmp(const char *s1, const char *s2); | Compares two strings, ignoring case.| +| | #include | int strncmp(const char *s1, const char *s2, size_t n); | Compares the bytes of the specified length in two strings.| +| | #include | char *strrchr(const char *s, int c); | Searches for the last occurrence of a character in a string.| +| | #include | char *strstr(const char *haystack, const char *needle); | Searches for the specified substring in a string.| +| | #include | long int strtol(const char *nptr, char **endptr, int base); | Converts the string pointed to by **nptr** into a **long int** value according to the given **base**.| +| | #include | unsigned long int strtoul(const char *nptr, char **endptr, int base); | Converts the string pointed to by **nptr** into an unsigned **long int** value according to the given **base**.| +| | #include | unsigned long long int strtoull(const char *nptr, char **endptr,int base); | Converts the string pointed to by **nptr** into an unsigned **long long int** value according to the given **base**.| +| | #include | int regcomp(regex_t *preg, const char *regex, int cflags); | Compiles a regular expression.| +| | #include | int regexec(const regex_t *preg, const char *string, size_t nmatch,regmatch_t pmatch[], int eflags); | Executes the compiled regular expression.| +| | #include | void regfree(regex_t *preg); | Releases the regular expression.| +| | #include | char *strerror(int errnum); | Obtains an error message string of the specified error code.| +| math | #include | int abs(int i); | Obtains the absolute value.| +| | #include | double log(double x); | Obtains the natural logarithm (base-e logarithm) of **x**.| +| | #include | double pow(double x, double y); | Obtains **x** raised to the power of **y**.| +| | #include | double round(double x); | Rounds off the value from zero to the nearest integer.| +| | #include | double sqrt(double x); | Obtains the square root of **x**.| +| IO | #include | void clearerr(FILE *stream); | Clears the file end and error indication of a stream.| +| | #include | int fclose(FILE *stream); | Closes a file stream.| +| | #include | FILE *fdopen(int fd, const char *mode); | Opens a file stream based on the file descriptor.| +| | #include | int feof(FILE *stream); | Checks the end-of-file indicator for a stream.| +| | #include | int fflush(FILE *stream); | Flushes a stream.| +| | #include | char *fgets(char *s, int size, FILE *stream); | Reads the next line of a stream.| +| | #include | int fileno(FILE *stream); | Obtains the file descriptor for a stream.| +| | #include | FILE *fopen(const char *path, const char *mode); | Opens a stream.| +| | #include | int fputs(const char *s, FILE *stream); | Writes a line to the specified stream.| +| | #include | size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); | Reads a stream.| +| | #include | int fseek(FILE *stream, long offset, int whence); | Sets the position of the stream pointer.| +| | #include | long ftell(FILE *stream); | Obtains the position of the stream pointer.| +| | #include | size_t fwrite(const void *ptr, size_t size, size_t nmemb,FILE *stream); | Writes data to a stream.| +| | #include | void perror(const char *s); | Prints system error information.| +| | #include | void rewind(FILE *stream); | Sets the position to the beginning of the file of the specified stream.| +| | #include | ssize_t write(int fd, const void *buf, size_t size); | Writes data a file.| +| | #include | ssize_t read(int fd, void *buf, size_t size); | Reads data from a file.| +| net | #include | void freeaddrinfo(struct addrinfo *res); | Releases the dynamic memory allocated using **getaddrinfo**.| +| | #include | int getaddrinfo(const char *restrict nodename,const char *restrict servname,const struct addrinfo *restrict hints,struct addrinfo **restrict res); | Obtains a list of IP addresses and port numbers for the specified host and service.| +| | #include | int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,char *restrict node, socklen_t nodelen, char *restrict service,socklen_t servicelen, int flags); | Converts a **socketaddr** structure to a pair of host name and service strings.| +| | #include | unsigned int if_nametoindex(const char *ifname); | Obtains the index based on the network port name.| +| | #include | in_addr_t inet_addr(const char *cp); | Converts the network host address in dotted decimal notation to binary format.| +| | #include | char *inet_ntoa(struct in_addr in); | Converts the network host address in binary format to dotted decimal notation.| +| | #include | const char *inet_ntop(int af, const void *src,char *dst, socklen_t size); | Converts the network address in binary format to text.| +| | #include | int inet_pton(int af, const char *src, void *dst); | Converts the network address in standard text format to numeric binary format.| +| | #include | int listen(int sockfd, int backlog); | Listens for connections on a socket.| +| | #include | ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags); | Receives a message from a socket. Currently, only the scenario with **iov** of **1** is supported and ancillary messages are not supported.| +| | #include | ssize_t send(int sockfd, const void *buf, size_t len, int flags); | Sends a message on a socket.| +| | #include | ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags); | Sends a message on a socket. Ancillary messages are not supported.| +| | #include | ssize_t sendto(int sockfd, const void *buf, size_t len, int flags,const struct sockaddr *dest_addr, socklen_t addrlen); | Sends a message on a socket.| +| | #include | int setsockopt(int sockfd, int level, int optname,const void *optval, socklen_t optlen); | Sets options associated with a socket.| +| mem | #include | int memcmp(const void *s1, const void *s2, size_t n); | Compares successive elements from two arrays until it finds elements that are different.| +| | #include | void *memcpy(void *dest, const void *src, size_t n); | Copies *n* bytes from the source memory area pointed to by **src** to the destination memory area pointed to by **dest**.| +| | #include | void *memset(void *s, int c, size_t n); | Initializes memory.| +| | #include | void *realloc(void *ptr, size_t size); | Reallocates memory.| +| | #include | void *malloc(size_t size); | Dynamically allocates memory blocks.| +| | #include | void free(void *ptr); | Release the memory space pointed to by **ptr**.| +| IPC | #include | int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout); | Locks the semaphore referenced by **sem** as in the **sem_wait()** function.| +| | #include | int sem_destroy(sem_t *sem); | Destroys the specified unnamed semaphore.| +| | #include | int sem_trywait(sem_t *sem); | Attempts to apply for a semaphore.| +| | #include | int sem_init(sem_t *sem, int pshared, unsigned int value); | Creates and initializes an unnamed semaphore.| +| | #include | int sem_post(sem_t *sem); | Increments the semaphore count by 1.| +| | #include | int sem_wait(sem_t *sem); | Obtains the semaphore.| +| | #include | mqd_t mq_open(const char *mqName, int openFlag, ...); | Opens an existing message queue with the specified name or creates a message queue.| +| | #include | int mq_close(mqd_t personal); | Closes a message queue with the specified descriptor.| +| | #include | int mq_unlink(const char *mqName); | Deletes the message queue of the specified name.| +| | #include | int mq_send(mqd_t personal, const char *msg, size_t msgLen, unsigned int msgPrio); | Puts a message with the specified content and length into a message queue.| +| | #include | ssize_t mq_receive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio); | Deletes the oldest message from a message queue and puts it in the buffer pointed to by **msg_ptr**.| +| | #include | int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int msgPrio, const struct timespec *absTimeout) | Puts a message with the specified content and length into a message queue at the specified time.| +| | #include | ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio, const struct timespec *absTimeout); | Obtains a message with the specified content and length from a message queue.| +| | #include | int mq_setattr(mqd_t mqdes, const struct mq_attr *__restrict newattr, struct mq_attr *__restrict oldattr); | Sets the message queue attributes specified by the descriptor.| +| version | #include | const char *libc_get_version_string(void); | Obtains the libc version string.| +| | #include | int libc_get_version(void); | Obtains the libc version.| + ### Important Notes Error codes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

C Name

-

Value

-

Description

-

Description

-

ENOERR

-

0

-

Success

-

Successful

-

EPERM

-

1

-

Operation not permitted

-

The operation is not allowed.

-

ENOENT

-

2

-

No such file or directory

-

The file or directory does not exist.

-

ESRCH

-

3

-

No such process

-

There is no such process (not supported currently).

-

EINTR

-

4

-

Interrupted system call

-

The system call is interrupted.

-

EIO

-

5

-

I/O error

-

An I/O error occurs.

-

ENXIO

-

6

-

No such device or address

-

The device or address does not exist.

-

E2BIG

-

7

-

Arg list too long

-

The parameter list is too long.

-

ENOEXEC

-

8

-

Exec format error

-

The execution format is incorrect.

-

EBADF

-

9

-

Bad file number

-

The file descriptor is invalid.

-

ECHILD

-

10

-

No child processes

-

There is no child process (not supported currently).

-

EAGAIN

-

11

-

Try again

-

The resource is temporarily unavailable.

-

ENOMEM

-

12

-

Out of memory

-

The memory overflows.

-

EACCES

-

13

-

Permission denied

-

The permission is rejected.

-

EFAULT

-

14

-

Bad address

-

The address is incorrect.

-

ENOTBLK

-

15

-

Block device required

-

A block device is required.

-

EBUSY

-

16

-

Device or resource busy

-

The device or resource is engaged.

-

EEXIST

-

17

-

File exists

-

The file already exists.

-

EXDEV

-

18

-

Cross-device link

-

The cross-device link is invalid.

-

ENODEV

-

19

-

No such device

-

The device does not exist.

-

ENOTDIR

-

20

-

Not a directory

-

It is not a directory.

-

EISDIR

-

21

-

Is a directory

-

It is a directory.

-

EINVAL

-

22

-

Invalid argument

-

The parameter is invalid.

-

ENFILE*

-

23

-

File table overflow

-

The number of file systems opened exceeds the limit.

-

EMFILE

-

24

-

Too many open files

-

The number of files opened exceeds the limit.

-

EFBIG

-

27

-

File too large

-

The file is too large.

-

ENOSPC

-

28

-

No space left on device

-

There is no space on the device.

-

ESPIPE

-

29

-

Illegal seek

-

Illegal shift

-

EROFS

-

30

-

Read-only file system

-

The file system is read-only.

-

EMLINK

-

31

-

Too many links

-

There are too many links.

-

EDOM

-

33

-

Math argument out of domain

-

The value is out of range.

-

ERANGE

-

34

-

Math result not representable

-

The result is not representative.

-

EDEADLK

-

35

-

Resource deadlock would occur

-

Resource deadlock occurs.

-

ENAMETOOLONG

-

36

-

Filename too long

-

The file name is too long.

-

ENOLCK

-

37

-

No record locks available

-

There is no lock available.

-

ENOSYS

-

38

-

Function not implemented

-

The function is not implemented.

-

ENOTEMPTY

-

39

-

Directory not empty

-

The directory is not empty.

-

ELOOP

-

40

-

Too many symbolic links encountered

-

There are too many symbolic link layers.

-

ENOMSG

-

42

-

No message of desired type

-

There is no message of the expected type.

-

EIDRM

-

43

-

Identifier removed

-

The identifier is removed.

-

ELNRNG

-

48

-

Link number out of range

-

The number of links exceeds the limit.

-

EBADR

-

53

-

Invalid request descriptor

-

The requested descriptor is invalid.

-

EBADRQC

-

56

-

Invalid request code

-

The requested code is invalid.

-

ENOSTR

-

60

-

Device not a stream

-

The device is not a character stream.

-

ENODATA

-

61

-

No data available

-

No data is available.

-

ETIME

-

62

-

Timer expired

-

The timer has expired.

-

EPROTO

-

71

-

Protocol error

-

Protocol error.

-

EBADMSG

-

74

-

Not a data message

-

It is not a data message.

-

EOVERFLOW

-

75

-

Value too large for defined data type

-

The value is too large for the data type.

-

EMSGSIZE

-

90

-

Message too long

-

The message is too long.

-
+| C Name | Value | Description | +| -------- | -------- | -------- | +| ENOERR | 0 | Success | +| EPERM | 1 | Operation not permitted | +| ENOENT | 2 | No such file or directory | +| ESRCH | 3 | No such process | +| EINTR | 4 | Interrupted system call | +| EIO | 5 | I/O error | +| ENXIO | 6 | No such device or address | +| E2BIG | 7 | Arg list too long | +| ENOEXEC | 8 | Exec format error | +| EBADF | 9 | Bad file number | +| ECHILD | 10 | No child processes | +| EAGAIN | 11 | Try again | +| ENOMEM | 12 | Out of memory | +| EACCES | 13 | Permission denied | +| EFAULT | 14 | Bad address | +| ENOTBLK | 15 | Block device required | +| EBUSY | 16 | Device or resource busy | +| EEXIST | 17 | File exists | +| EXDEV | 18 | Cross-device link | +| ENODEV | 19 | No such device | +| ENOTDIR | 20 | Not a directory | +| EISDIR | 21 | Is a directory | +| EINVAL | 22 | Invalid argument | +| ENFILE* | 23 | File table overflow | +| EMFILE | 24 | Too many open files | +| EFBIG | 27 | File too large | +| ENOSPC | 28 | No space left on device | +| ESPIPE | 29 | Illegal seek | +| EROFS | 30 | Read-only file system | +| EMLINK | 31 | Too many links | +| EDOM | 33 | Math argument out of domain | +| ERANGE | 34 | Math result not representable | +| EDEADLK | 35 | Resource deadlock would occur | +| ENAMETOOLONG | 36 | Filename too long | +| ENOLCK | 37 | No record locks available | +| ENOSYS | 38 | Function not implemented | +| ENOTEMPTY | 39 | Directory not empty | +| ELOOP | 40 | Too many symbolic links encountered | +| ENOMSG | 42 | No message of desired type | +| EIDRM | 43 | Identifier removed | +| ELNRNG | 48 | Link number out of range | +| EBADR | 53 | Invalid request descriptor | +| EBADRQC | 56 | Invalid request code | +| ENOSTR | 60 | Device not a stream | +| ENODATA | 61 | No data available | +| ETIME | 62 | Timer expired | +| EPROTO | 71 | Protocol error | +| EBADMSG | 74 | Not a data message | +| EOVERFLOW | 75 | Value too large for defined data type | +| EMSGSIZE | 90 | Message too long | ### Development Example @@ -1634,4 +291,3 @@ The execution result of **DemoForTest** is as follows: ++++++++++++++ Hello world ThreadFn tid = 48 ++++++++++++++ ``` - -- Gitee