LINUX驱动出错返回值规范

简介: LINUX驱动出错返回值规范

在编写的时候加个负号,如:return -EPERM表示权限不足的错误

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H
#define EPERM    1  /* Operation not permitted */
#define ENOENT     2  /* No such file or directory */
#define ESRCH    3  /* No such process */
#define EINTR    4  /* Interrupted system call */
#define EIO    5  /* I/O error */
#define ENXIO    6  /* No such device or address */
#define E2BIG    7  /* Argument list too long */
#define ENOEXEC    8  /* Exec format error */
#define EBADF    9  /* Bad file number */
#define ECHILD    10  /* No child processes */
#define EAGAIN    11  /* Try again */
#define ENOMEM    12  /* Out of memory */
#define EACCES    13  /* Permission denied */
#define EFAULT    14  /* Bad address */
#define ENOTBLK   15  /* Block device required */
#define EBUSY   16  /* Device or resource busy */
#define EEXIST    17  /* File exists */
#define EXDEV   18  /* Cross-device link */
#define ENODEV    19  /* No such device */
#define ENOTDIR   20  /* Not a directory */
#define EISDIR    21  /* Is a directory */
#define EINVAL    22  /* Invalid argument */
#define ENFILE    23  /* File table overflow */
#define EMFILE    24  /* Too many open files */
#define ENOTTY    25  /* Not a typewriter */
#define ETXTBSY   26  /* Text file busy */
#define EFBIG   27  /* File too large */
#define ENOSPC    28  /* No space left on device */
#define ESPIPE    29  /* Illegal seek */
#define EROFS   30  /* Read-only file system */
#define EMLINK    31  /* Too many links */
#define EPIPE   32  /* Broken pipe */
#define EDOM    33  /* Math argument out of domain of func */
#define ERANGE    34  /* Math result not representable */
#endif
目录
相关文章
|
2月前
|
Linux API 调度
Linux系统驱动跟裸机驱动的区别
Linux系统驱动跟裸机驱动的区别
33 0
|
2月前
|
Linux C语言 SoC
嵌入式linux总线设备驱动模型分析
嵌入式linux总线设备驱动模型分析
33 1
|
2月前
|
存储 缓存 Linux
【Shell 命令集合 磁盘维护 】Linux 设置和查看硬盘驱动器参数 hdparm命令使用教程
【Shell 命令集合 磁盘维护 】Linux 设置和查看硬盘驱动器参数 hdparm命令使用教程
39 0
|
2月前
|
分布式计算 关系型数据库 MySQL
Sqoop【部署 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
【2月更文挑战第8天】Sqoop CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
108 1
|
6天前
|
Linux
linux驱动层输出dev_dbg打印信息
linux驱动层输出dev_dbg打印信息
11 0
|
14天前
|
存储 监控 Linux
【专栏】在 Linux 中,了解已安装驱动器是系统管理的关键
【4月更文挑战第28天】在 Linux 中,了解已安装驱动器是系统管理的关键。本文介绍了三种方法:1) 使用 `lsblk` 命令显示设备名、大小和类型;2) `fdisk -l` 命令提供详细分区信息;3) `gnome-disks` 等系统管理工具展示驱动器信息。此外,还讨论了驱动器类型识别、挂载点概念及其应用。通过这些方法,用户能有效地监控和管理 Linux 系统中的驱动器。
|
28天前
|
Linux Go
Linux命令Top 100驱动人生! 面试必备
探索Linux命令不再迷茫!本文分10部分详解20个基础命令,带你由浅入深掌握文件、目录管理和文本处理。 [1]: <https://cloud.tencent.com/developer/article/2396114> [2]: <https://pan.quark.cn/s/865a0bbd5720> [3]: <https://yv4kfv1n3j.feishu.cn/docx/MRyxdaqz8ow5RjxyL1ucrvOYnnH>
79 0
|
1月前
|
Linux
Linux驱动运行灯 Heartbeat
Linux驱动运行灯 Heartbeat
23 0
|
2月前
|
Linux
Linux内核中USB设备驱动实现
Linux内核中USB设备驱动实现
30 0