跳转至

errno

errno 提供OSAL (Operating System Abstraction Layer) 内部错误码到POSIX标准errno值的映射功能,使上层应用可使用标准errno机制获取错误信息。

头文件清单

#include "include/osal/osal_errno.h"

接口清单

接口名称 功能简述
osal_map_errno 将OSAL内部错误码映射为POSIX标准errno值

Functions

osal_map_errno

int osal_map_errno(int err)

头文件清单

#include "include/osal/osal_errno.h"

功能说明

  • 将OSAL内部错误码转换为POSIX标准errno值,使上层应用可使用标准errno机制获取错误信息
  • 用于OSAL层与POSIX层之间的错误码桥接,确保跨操作系统平台的错误码语义一致性
  • 调用后不修改原错误码,仅返回映射后的POSIX errno值

入参

名称 参数类型 详细说明 约束取值范围
err int 待映射的OSAL内部错误码 OSAL_EINTR(-4) / OSAL_EINVAL(-22) / OSAL_ETIME(-62) / OSAL_EOVERFLOW(-75) / OSAL_ERRNO_QUEUE_ISFULL(0x02000616) / OSAL_ERRNO_NO_MEMORY(0x02000903) / OSAL_ERRNO_QUEUE_ISEMPTY(0x0200061d) / OSAL_ERRNO_TSK_PRIOR_ERROR(0x02000203)

返回值

  • 返回类型:int
返回值 文字含义 触发场景
int - -

Macros

OSAL_EINTR

#define OSAL_EINTR (-4)  /* Interrupted system call */

OSAL_EINVAL

#define OSAL_EINVAL (-22)  /* Interrupted system call */

OSAL_ETIME

#define OSAL_ETIME (-62)  /* Timer expired */

OSAL_EOVERFLOW

#define OSAL_EOVERFLOW (-75)  /* Value too large for defined data type */

OSAL_ERRNO_QUEUE_ISFULL

#define OSAL_ERRNO_QUEUE_ISFULL 0x02000616

OSAL_ERRNO_NO_MEMORY

#define OSAL_ERRNO_NO_MEMORY 0x02000903

OSAL_ERRNO_QUEUE_ISEMPTY

#define OSAL_ERRNO_QUEUE_ISEMPTY 0x0200061d

OSAL_ERRNO_TSK_PRIOR_ERROR

#define OSAL_ERRNO_TSK_PRIOR_ERROR 0x02000203