修改errno,使其与relibc的保持一致 (#234)

修改errno,使其与relibc的保持一致
This commit is contained in:
houmkh
2023-04-11 17:05:33 +08:00
committed by GitHub
parent ac48398d3f
commit 79a452ce8f
20 changed files with 593 additions and 402 deletions

View File

@ -9,93 +9,135 @@
*
*/
#pragma once
#define E2BIG 1 /* 参数列表过长或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long. */
#define EACCES 2 /* 访问被拒绝 Permission denied */
#define EADDRINUSE 3 /* 地址正在被使用 Address in use.*/
#define EADDRNOTAVAIL 4 /* 地址不可用 Address not available.*/
#define EAFNOSUPPORT 5 /* 地址family不支持 Address family not supported. */
#define EAGAIN 6 /* 资源不可用,请重试。 Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).*/
#define EALREADY 7 /* 连接已经在处理 Connection already in progress. */
#define EBADF 8 /* 错误的文件描述符 Bad file descriptor. */
#define EBADMSG 9 /* 错误的消息 Bad message. */
#define EBUSY 10 /* 设备或资源忙 Device or resource busy. */
#define ECANCELED 11 /* 操作被取消 Operation canceled. */
#define ECHILD 12 /* 没有子进程 No child processes. */
#define ECONNABORTED 13 /* 连接已断开 Connection aborted. */
#define ECONNREFUSED 14 /* 连接被拒绝 Connection refused. */
#define ECONNRESET 15 /* 连接被重置 Connection reset. */
#define EDEADLK 16 /* 资源死锁将要发生 Resource deadlock would occur. */
#define EDESTADDRREQ 17 /* 需要目标地址 Destination address required.*/
#define EDOM 18 /* 数学参数超出作用域 Mathematics argument out of domain of function. */
#define EDQUOT 19 /* 保留使用 Reserved */
#define EEXIST 20 /* 文件已存在 File exists. */
#define EFAULT 21 /* 错误的地址 Bad address */
#define EFBIG 22 /* 文件太大 File too large. */
#define EHOSTUNREACH 23 /* 主机不可达 Host is unreachable.*/
#define EIDRM 24 /* 标志符被移除 Identifier removed. */
#define EILSEQ 25 /* 不合法的字符序列 Illegal byte sequence. */
#define EINPROGRESS 26 /* 操作正在处理 Operation in progress. */
#define EINTR 27 /* 被中断的函数 Interrupted function. */
#define EINVAL 28 /* 不可用的参数 Invalid argument. */
#define EIO 29 /* I/O错误 I/O error. */
#define EISCONN 30 /* 套接字已连接 Socket is connected. */
#define EISDIR 31 /* 是一个目录 Is a directory */
#define ELOOP 32 /* 符号链接级别过多 Too many levels of symbolic links. */
#define EMFILE 33 /* 文件描述符的值过大 File descriptor value too large. */
#define EMLINK 34 /* 链接数过多 Too many links. */
#define EMSGSIZE 35 /* 消息过大 Message too large. */
#define EMULTIHOP 36 /* 保留使用 Reserved. */
#define ENAMETOOLONG 37 /* 文件名过长 Filename too long. */
#define ENETDOWN 38 /* 网络已关闭 Network is down. */
#define ENETRESET 39 /* 网络连接已断开 Connection aborted by network. */
#define ENETUNREACH 40 /* 网络不可达 Network unreachable. */
#define ENFILE 41 /* 系统中打开的文件过多 Too many files open in system.*/
#define ENOBUFS 42 /* 缓冲区空间不足 No buffer space available. */
#define ENODATA 43 /* 队列头没有可读取的消息 No message is available on the STREAM head read queue. */
#define ENODEV 44 /* 没有指定的设备 No such device. */
#define ENOENT 45 /* 没有指定的文件或目录 No such file or directory. */
#define ENOEXEC 46 /* 可执行文件格式错误 Executable file format error. */
#define ENOLCK 47 /* 没有可用的锁 No locks available. */
#define ENOLINK 48 /* 保留 Reserved. */
#define ENOMEM 49 /* 没有足够的空间 Not enough space. */
#define ENOMSG 50 /* 没有期待类型的消息 No message of the desired type. */
#define ENOPROTOOPT 51 /* 协议不可用 Protocol not available. */
#define ENOSPC 52 /* 设备上没有空间 No space left on device. */
#define ENOSR 53 /* 没有STREAM资源 No STREAM resources.*/
#define ENOSTR 54 /* 不是STREAM Not a STREAM */
#define ENOSYS 55 /* 功能不支持 Function not supported. */
#define ENOTCONN 56 /* 套接字未连接 The socket is not connected. */
#define ENOTDIR 57 /* 不是目录 Not a directory. */
#define ENOTEMPTY 58 /* 目录非空 Directory not empty. */
#define ENOTRECOVERABLE 59 /* 状态不可恢复 State not recoverable. */
#define ENOTSOCK 60 /* 不是一个套接字 Not a socket.*/
#define ENOTSUP 61 /* 不被支持 Not supported (may be the same value as [EOPNOTSUPP]). */
#define ENOTTY 62 /* 不正确的I/O控制操作 Inappropriate I/O control operation. */
#define ENXIO 63 /* 没有这样的设备或地址 No such device or address. */
#define EOPNOTSUPP 64 /* 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]). */
#define EOVERFLOW 65 /* 数值过大,产生溢出 Value too large to be stored in data type. */
#define EOWNERDEAD 66 /* 之前的拥有者挂了 Previous owner died. */
#define EPERM 67 /* 操作不被允许 Operation not permitted. */
#define EPIPE 68 /* 断开的管道 Broken pipe. */
#define EPROTO 69 /* 协议错误 Protocol error. */
#define EPROTONOSUPPORT 70 /* 协议不被支持 Protocol not supported. */
#define EPROTOTYPE 71 /* 对于套接字而言,错误的协议 Protocol wrong type for socket. */
#define ERANGE 72 /* 结果过大 Result too large. */
#define EROFS 73 /* 只读的文件系统 Read-only file system. */
#define ESPIPE 74 /* 错误的寻道.当前文件是pipe不允许seek请求 Invalid seek. */
#define ESRCH 75 /* 没有这样的进程 No such process. */
#define ESTALE 76 /* 保留 Reserved. */
#define ETIME 77 /* 流式ioctl()超时 Stream ioctl() timeout */
#define ETIMEDOUT 78 /* 连接超时 Connection timed out.*/
#define ETXTBSY 79 /* 文本文件忙 Text file busy. */
#define EWOULDBLOCK 80 /* 操作将被禁止 Operation would block (may be the same value as [EAGAIN]). */
#define EXDEV 81 /* 跨设备连接 Cross-device link. */
#define EPERM 1 /* 操作不被允许 Operation not permitted. */
#define ENOENT 2 /* 没有指定的文件或目录 No such file or directory. */
#define ESRCH 3 /* 没有这样的进程 No such process. */
#define EINTR 4 /* 被中断的函数 Interrupted function. */
#define EIO 5 /* I/O错误 I/O error. */
#define ENXIO 6 /* 没有这样的设备或地址 No such device or address. */
#define E2BIG 7 /* 参数列表过长或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long. */
#define ENOEXEC 8 /* 可执行文件格式错误 Executable file format error */
#define EBADF 9 /* 错误的文件描述符 Bad file descriptor. */
#define ECHILD 10 /* 没有子进程 No child processes. */
#define EAGAIN 11 /* 资源不可用,请重试。 Resource unavailable try again.(may be the same value as [EWOULDBLOCK]) */
#define EWOULDBLOCK 11 /* 操作将被禁止 Operation would block.(may be the same value as [EAGAIN]). */
#define ENOMEM 12 /* 没有足够的空间 Not enough space. */
#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 /* 系统中打开的文件过多 Too many files open in system. */
#define EMFILE 24 /* 文件描述符的值过大 File descriptor value too large. */
#define ENOTTY 25 /* 不正确的I/O控制操作 Inappropriate I/O control operation. */
#define ETXTBSY 26 /* 文本文件忙 Text file busy. */
#define EFBIG 27 /* 文件太大 File too large. */
#define ENOSPC 28 /* 设备上没有空间 No space left on device. */
#define ESPIPE 29 /* 错误的寻道.当前文件是pipe不允许seek请求 Invalid seek. */
#define EROFS 30 /* 只读的文件系统 Read-only file system. */
#define EMLINK 31 /* 链接数过多 Too many links. */
#define EPIPE 32 /* 断开的管道 Broken pipe. */
#define EDOM 33 /* 数学参数超出作用域 Mathematics argument out of domain of function. */
#define ERANGE 34 /* 结果过大 Result too large. */
#define EDEADLK 35 /* 资源死锁将要发生 Resource deadlock would occur. */
#define ENAMETOOLONG 36 /* 文件名过长 Filename too long. */
#define ENOLCK 37 /* 没有可用的锁 No locks available. */
#define ENOSYS 38 /* 功能不支持 Function not supported. */
#define ENOTEMPTY 39 /* 目录非空 Directory not empty. */
#define ELOOP 40 /* 符号链接级别过多 Too many levels of symbolic links. */
#define ENOMSG 41 /* 没有期待类型的消息 No message of the desired type. */
#define EIDRM 42 /* 标志符被移除 Identifier removed. */
#define ECHRNG 43 /* 通道号超出范围 Channel number out of range */
#define EL2NSYNC 44 /* 二级不同步 Level 2 not synchronized */
#define EL3HLT 45 /* 三级暂停 Level 3 halted */
#define EL3RST 46 /* 三级重置 Level 3 reset */
#define ELNRNG 47 /* 链接号超出范围 Link number out of range */
#define EUNATCH 48 /* 未连接协议驱动程序 Protocol driver not attached */
#define ENOCSI 49 /* 没有可用的CSI结构 No CSI structure available */
#define EL2HLT 50 /* 二级暂停 Level 2 halted */
#define EBADE 51 /* 无效交换 Invalid exchange */
#define EBADR 52 /* 无效的请求描述符 Invalid request descriptor */
#define EXFULL 53 /* 交换满 Exchange full */
#define ENOANO 54 /* 无阳极 No anode */
#define EBADRQC 55 /* 请求码无效 Invalid request code */
#define EBADSLT 56 /* 无效插槽 Invalid slot */
#define EDEADLOCK 57 /* 资源死锁 Resource deadlock would occur */
#define EBFONT 58 /* 错误的字体文件格式 Bad font file format */
#define ENOSTR 59 /* 不是STREAM Not a STREAM */
#define ENODATA 60 /* 队列头没有可读取的消息 No message is available on the STREAM head read queue. */
#define ETIME 61 /* 流式ioctl()超时 Stream ioctl() timeout */
#define ENOSR 62 /* 没有STREAM资源 No STREAM resources. */
#define ENONET 63 /* 机器不在网络上 Machine is not on the network */
#define ENOPKG 64 /* 未安装软件包 Package not installed */
#define EREMOTE 65 /* 远程对象 Object is remote */
#define ENOLINK 66 /* 保留 Reserved. */
#define EADV 67 /* 外设错误 Advertise error. */
#define ESRMNT 68 /* 安装错误 Srmount error */
#define ECOMM 69 /* 发送时发生通信错误 Communication error on send */
#define EPROTO 70 /* 协议错误 Protocol error. */
#define EMULTIHOP 71 /* 保留使用 Reserved. */
#define EDOTDOT 72 /* RFS特定错误 RFS specific error */
#define EBADMSG 73 /* 错误的消息 Bad message. */
#define EOVERFLOW 74 /* 数值过大,产生溢出 Value too large to be stored in data type. */
#define ENOTUNIQ 75 /* 名称在网络上不是唯一的 Name not unique on network */
#define EBADFD 76 /* 处于不良状态的文件描述符 File descriptor in bad state */
#define EREMCHG 77 /* 远程地址已更改 Remote address changed */
#define ELIBACC 78 /* 无法访问所需的共享库 Can not access a needed shared library */
#define ELIBBAD 79 /* 访问损坏的共享库 Accessing a corrupted shared library */
#define ELIBSCN 80 /* a. out中的.lib部分已损坏 .lib section in a.out corrupted */
#define ELIBMAX 81 /* 尝试链接太多共享库 Attempting to link in too many shared libraries */
#define ELIBEXEC 82 /* 无法直接执行共享库 Cannot exec a shared library directly */
#define EILSEQ 83 /* 不合法的字符序列 Illegal byte sequence. */
#define ERESTART 84 /* 中断的系统调用应该重新启动 Interrupted system call should be restarted */
#define ESTRPIPE 85 /* 流管道错误 Streams pipe error */
#define EUSERS 86 /* 用户太多 Too many users */
#define ENOTSOCK 87 /* 不是一个套接字 Not a socket. */
#define EDESTADDRREQ 88 /* 需要目标地址 Destination address required. */
#define EMSGSIZE 89 /* 消息过大 Message too large. */
#define EPROTOTYPE 90 /* 对于套接字而言,错误的协议 Protocol wrong type for socket. */
#define ENOPROTOOPT 91 /* 协议不可用 Protocol not available. */
#define EPROTONOSUPPORT 92 /* 协议不被支持 Protocol not supported. */
#define ESOCKTNOSUPPORT 93 /* 不支持套接字类型 Socket type not supported */
#define EOPNOTSUPP 94 /* 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]). */
#define ENOTSUP 94 /* 不被支持 Not supported (may be the same value as [EOPNOTSUPP]). */
#define EPFNOSUPPORT 95 /* 不支持协议系列 Protocol family not supported */
#define EAFNOSUPPORT 96 /* 地址family不支持 Address family not supported. */
#define EADDRINUSE 97 /* 地址正在被使用 Address in use. */
#define EADDRNOTAVAIL 98 /* 地址不可用 Address not available. */
#define ENETDOWN 99 /* 网络已关闭 Network is down. */
#define ENETUNREACH 100 /* 网络不可达 Network unreachable. */
#define ENETRESET 101 /* 网络连接已断开 Connection aborted by network. */
#define ECONNABORTED 102 /* 连接已断开 Connection aborted. */
#define ECONNRESET 103 /* 连接被重置 Connection reset. */
#define ENOBUFS 104 /* 缓冲区空间不足 No buffer space available. */
#define EISCONN 105 /* 套接字已连接 Socket is connected. */
#define ENOTCONN 106 /* 套接字未连接 The socket is not connected. */
#define ESHUTDOWN 107 /* 传输端点关闭后无法发送 Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 108 /* 引用太多:无法拼接 Too many references: cannot splice */
#define ETIMEDOUT 109 /* 连接超时 Connection timed out. */
#define ECONNREFUSED 110 /* 连接被拒绝 Connection refused. */
#define EHOSTDOWN 111 /* 主机已关闭 Host is down */
#define EHOSTUNREACH 112 /* 主机不可达 Host is unreachable. */
#define EALREADY 113 /* 连接已经在处理 Connection already in progress. */
#define EINPROGRESS 114 /* 操作正在处理 Operation in progress. */
#define ESTALE 115 /* 保留 Reserved. */
#define EUCLEAN 116 /* 结构需要清理 Structure needs cleaning */
#define ENOTNAM 117 /* 不是XENIX命名类型文件 Not a XENIX named type file */
#define ENAVAIL 118 /* 没有可用的XENIX信号量 No XENIX semaphores available */
#define EISNAM 119 /* 是命名类型文件 Is a named type file */
#define EREMOTEIO 120 /* 远程I/O错误 Remote I/O error */
#define EDQUOT 121 /* 保留使用 Reserved */
#define ENOMEDIUM 122 /* 没有找到媒介 No medium found */
#define EMEDIUMTYPE 123 /* 介质类型错误 Wrong medium type */
#define ECANCELED 124 /* 操作被取消 Operation canceled. */
#define ENOKEY 125 /* 所需的密钥不可用 Required key not available */
#define EKEYEXPIRED 126 /* 密钥已过期 Key has expired */
#define EKEYREVOKED 127 /* 密钥已被撤销 Key has been revoked */
#define EKEYREJECTED 128 /* 密钥被服务拒绝 Key has been revoked */
#define EOWNERDEAD 129 /* 之前的拥有者挂了 Previous owner died. */
#define ENOTRECOVERABLE 130 /* 状态不可恢复 State not recoverable. */

View File

@ -76,11 +76,11 @@ impl IndexNode for LockedAhciInode {
}
fn open(&self, _data: &mut FilePrivateData, _mode: &FileMode) -> Result<(), SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn close(&self, _data: &mut FilePrivateData) -> Result<(), SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn metadata(&self) -> Result<Metadata, SystemError> {
@ -92,7 +92,7 @@ impl IndexNode for LockedAhciInode {
}
fn list(&self) -> Result<Vec<String>, SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn set_metadata(&self, metadata: &Metadata) -> Result<(), SystemError> {

View File

@ -117,7 +117,7 @@ impl IndexNode for LockedPS2KeyBoardInode {
_buf: &[u8],
_data: &mut crate::filesystem::vfs::FilePrivateData,
) -> Result<usize, SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
fn open(
@ -180,7 +180,7 @@ impl IndexNode for LockedPS2KeyBoardInode {
}
fn list(&self) -> Result<alloc::vec::Vec<alloc::string::String>, SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
}

View File

@ -287,7 +287,7 @@ impl<T: Transport> NetDriver for VirtioInterface<T> {
if poll_res {
return Ok(());
}
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
#[inline(always)]

View File

@ -210,7 +210,7 @@ impl IndexNode for TtyDevice {
}
fn poll(&self) -> Result<crate::filesystem::vfs::PollStatus, SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
fn fs(&self) -> Arc<dyn crate::filesystem::vfs::FileSystem> {
@ -222,7 +222,7 @@ impl IndexNode for TtyDevice {
}
fn list(&self) -> Result<alloc::vec::Vec<alloc::string::String>, SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
fn metadata(&self) -> Result<Metadata, SystemError> {

View File

@ -138,7 +138,7 @@ impl DevFS {
device.set_fs(dev_block_inode.0.lock().fs.clone());
}
_ => {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
}
@ -181,7 +181,7 @@ impl DevFS {
dev_block_inode.remove(name)?;
}
_ => {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
}
@ -423,7 +423,7 @@ impl IndexNode for LockedDevFSInode {
}
fn ioctl(&self, _cmd: u32, _data: usize) -> Result<usize, SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn list(&self) -> Result<Vec<String>, SystemError> {
@ -479,7 +479,7 @@ impl IndexNode for LockedDevFSInode {
_data: &mut super::vfs::file::FilePrivateData,
) -> Result<usize, SystemError> {
kerror!("DevFS: read_at is not supported!");
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
/// 写设备 - 应该调用设备的函数读写,而不是通过文件系统读写
@ -490,7 +490,7 @@ impl IndexNode for LockedDevFSInode {
_buf: &[u8],
_data: &mut super::vfs::file::FilePrivateData,
) -> Result<usize, SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
}

View File

@ -70,11 +70,11 @@ impl IndexNode for LockedNullInode {
}
fn open(&self, _data: &mut FilePrivateData, _mode: &FileMode) -> Result<(), SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn close(&self, _data: &mut FilePrivateData) -> Result<(), SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn metadata(&self) -> Result<Metadata, SystemError> {
@ -86,7 +86,7 @@ impl IndexNode for LockedNullInode {
}
fn list(&self) -> Result<Vec<String>, SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn set_metadata(&self, metadata: &Metadata) -> Result<(), SystemError> {

View File

@ -70,11 +70,11 @@ impl IndexNode for LockedZeroInode {
}
fn open(&self, _data: &mut FilePrivateData, _mode: &FileMode) -> Result<(), SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn close(&self, _data: &mut FilePrivateData) -> Result<(), SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn metadata(&self) -> Result<Metadata, SystemError> {
@ -86,7 +86,7 @@ impl IndexNode for LockedZeroInode {
}
fn list(&self) -> Result<Vec<String>, SystemError> {
Err(SystemError::ENOTSUP)
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
}
fn set_metadata(&self, metadata: &Metadata) -> Result<(), SystemError> {

View File

@ -1441,7 +1441,7 @@ impl IndexNode for LockedFATInode {
return Ok(guard.find(name)?);
}
FileType::SymLink => return Err(SystemError::ENOTSUP),
FileType::SymLink => return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP),
_ => return Err(SystemError::EINVAL),
},
FATDirEntry::UnInit => {

View File

@ -413,7 +413,7 @@ impl IndexNode for LockedProcFSInode {
_buf: &[u8],
_data: &mut FilePrivateData,
) -> Result<usize, SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
fn poll(&self) -> Result<PollStatus, SystemError> {
@ -581,7 +581,7 @@ impl IndexNode for LockedProcFSInode {
_target: &Arc<dyn IndexNode>,
_new_name: &str,
) -> Result<(), SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
fn find(&self, name: &str) -> Result<Arc<dyn IndexNode>, SystemError> {

View File

@ -91,7 +91,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn open(&self, _data: &mut FilePrivateData, _mode: &FileMode) -> Result<(), SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 关闭文件
@ -100,7 +100,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn close(&self, _data: &mut FilePrivateData) -> Result<(), SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 在inode的指定偏移量开始读取指定大小的数据
@ -148,7 +148,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn metadata(&self) -> Result<Metadata, SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 设置inode的元数据
@ -157,7 +157,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn set_metadata(&self, _metadata: &Metadata) -> Result<(), SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 重新设置文件的大小
@ -166,7 +166,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn resize(&self, _len: usize) -> Result<(), SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 在当前目录下创建一个新的inode
@ -183,7 +183,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
file_type: FileType,
mode: u32,
) -> Result<Arc<dyn IndexNode>, SystemError> {
// 若文件系统没有实现此方法则默认调用其create_with_data方法。如果仍未实现则会得到一个Err(-ENOTSUP)的返回值
// 若文件系统没有实现此方法则默认调用其create_with_data方法。如果仍未实现则会得到一个Err(-EOPNOTSUPP_OR_ENOTSUP)的返回值
return self.create_with_data(name, file_type, mode, 0);
}
@ -204,7 +204,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
_data: usize,
) -> Result<Arc<dyn IndexNode>, SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 在当前目录下创建一个名为Name的硬链接指向另一个IndexNode
@ -216,7 +216,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn link(&self, _name: &str, _other: &Arc<dyn IndexNode>) -> Result<(), SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 在当前目录下删除一个名为Name的硬链接
@ -227,7 +227,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn unlink(&self, _name: &str) -> Result<(), SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 删除文件夹
@ -237,7 +237,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// @return 成功 Ok(())
/// @return 失败 Err(错误码)
fn rmdir(&self, _name: &str) -> Result<(), SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 将指定名称的子目录项的文件内容移动到target这个目录下。如果_old_name所指向的inode与_target的相同那么则直接执行重命名的操作。
@ -257,7 +257,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
_new_name: &str,
) -> Result<(), SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 寻找一个名为Name的inode
@ -268,7 +268,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn find(&self, _name: &str) -> Result<Arc<dyn IndexNode>, SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 根据inode号获取子目录项的名字
@ -279,7 +279,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn get_entry_name(&self, _ino: InodeId) -> Result<String, SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 根据inode号获取子目录项的名字和元数据
@ -304,7 +304,7 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// 失败Err(错误码)
fn ioctl(&self, _cmd: u32, _data: usize) -> Result<usize, SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 获取inode所在的文件系统的指针
@ -320,14 +320,14 @@ pub trait IndexNode: Any + Sync + Send + Debug {
/// @brief 在当前Inode下挂载一个新的文件系统
/// 请注意该函数只能被MountFS实现其他文件系统不应实现这个函数
fn mount(&self, _fs: Arc<dyn FileSystem>) -> Result<Arc<MountFS>, SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 截断当前inode到指定的长度。如果当前文件长度小于len,则不操作。
///
/// @param len 要被截断到的目标长度
fn truncate(&self, _len: usize) -> Result<(), SystemError> {
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
/// @brief 将当前inode的内容同步到具体设备上

View File

@ -117,7 +117,7 @@ fn signal_kill_something_info(
// 暂时不支持特殊的kill操作
if pid <= 0 {
kwarn!("Kill operation not support: pid={}", pid);
return Err(SystemError::ENOTSUP);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
}
// kill单个进程

View File

@ -114,13 +114,13 @@ impl LockRef {
return Err(SystemError::ETIMEDOUT.to_posix_errno());
}
/// @brief 对于不支持无锁lockref的架构直接返回Err(SystemError::ENOTSUP),表示不支持
/// @brief 对于不支持无锁lockref的架构直接返回Err(SystemError::EOPNOTSUPP_OR_ENOTSUP),表示不支持
#[cfg(not(target_arch = "x86_64"))]
#[inline]
fn cmpxchg_loop(&mut self, mode: CmpxchgMode) -> Result<i32, i32> {
use crate::include::bindings::bindings::ENOTSUP;
use crate::include::bindings::bindings::EOPNOTSUPP_OR_ENOTSUP;
return Err(SystemError::ENOTSUP.to_posix_errno());
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP.to_posix_errno());
}
/// @brief 原子的将引用计数加1
@ -239,7 +239,9 @@ impl LockRef {
return Err(SystemError::EPERM);
}
// 由于cmpxchg超时操作失败
if *cmpxchg_result.as_ref().unwrap_err() != SystemError::ENOTSUP.to_posix_errno() {
if *cmpxchg_result.as_ref().unwrap_err()
!= SystemError::EOPNOTSUPP_OR_ENOTSUP.to_posix_errno()
{
return Err(SystemError::EFAULT);
}

View File

@ -210,7 +210,7 @@ impl<T> SpinLock<T> {
flag: 0,
});
}
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
pub fn try_lock_irqsave(&self) -> Result<SpinLockGuard<T>, SystemError> {
@ -221,7 +221,7 @@ impl<T> SpinLock<T> {
flag: flags,
});
}
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
}

View File

@ -164,7 +164,7 @@ impl Socket for RawSocket {
Err(smoltcp::socket::raw::RecvError::Exhausted) => {
if !self.options.contains(SocketOptions::BLOCK) {
// 如果是非阻塞的socket就返回错误
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
}
}
@ -329,7 +329,7 @@ impl Socket for UdpSocket {
}
} else {
// 没有数据可以读取. 如果没有bind到指定端口也会导致rx_buf为空
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
}
}
@ -487,7 +487,7 @@ impl Socket for TcpSocket {
}
}
} else {
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
}
}

View File

@ -114,8 +114,10 @@ void __switch_to(struct process_control_block *prev, struct process_control_bloc
// initial_tss[0].ist2, initial_tss[0].ist3, initial_tss[0].ist4, initial_tss[0].ist5,
// initial_tss[0].ist6, initial_tss[0].ist7);
__asm__ __volatile__("movq %%fs, %0 \n\t" : "=a"(prev->thread->fs));
__asm__ __volatile__("movq %%gs, %0 \n\t" : "=a"(prev->thread->gs));
__asm__ __volatile__("movq %%fs, %0 \n\t"
: "=a"(prev->thread->fs));
__asm__ __volatile__("movq %%gs, %0 \n\t"
: "=a"(prev->thread->gs));
__asm__ __volatile__("movq %0, %%fs \n\t" ::"a"(next->thread->fs));
__asm__ __volatile__("movq %0, %%gs \n\t" ::"a"(next->thread->gs));

View File

@ -2,170 +2,272 @@ use num_traits::{FromPrimitive, ToPrimitive};
#[repr(i32)]
#[derive(Debug, FromPrimitive, ToPrimitive, PartialEq, Eq, Clone)]
#[allow(dead_code)]
#[allow(dead_code, non_camel_case_types)]
pub enum SystemError {
/// 参数列表过长或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long.
E2BIG = 1,
/// 访问被拒绝 Permission denied
EACCES = 2,
/// 地址正在被使用 Address in use.
EADDRINUSE = 3,
/// 地址不可用 Address not available.
EADDRNOTAVAIL = 4,
/// 地址family不支持 Address family not supported.
EAFNOSUPPORT = 5,
/// 资源不可用,请重试。 Resource unavailable, try again (may be the same value as [EWOULDBLOCK])
EAGAIN = 6,
/// 连接已经在处理 Connection already in progress.
EALREADY = 7,
/// 错误的文件描述符 Bad file descriptor.
EBADF = 8,
/// 错误的消息 Bad message.
EBADMSG = 9,
/// 设备或资源忙 Device or resource busy.
EBUSY = 10,
/// 操作被取消 Operation canceled.
ECANCELED = 11,
/// 没有子进程 No child processes.
ECHILD = 12,
/// 连接已断开 Connection aborted.
ECONNABORTED = 13,
/// 连接被拒绝 Connection refused.
ECONNREFUSED = 14,
/// 连接被重置 Connection reset.
ECONNRESET = 15,
/// 资源死锁将要发生 Resource deadlock would occur.
EDEADLK = 16,
/// 需要目标地址 Destination address required.
EDESTADDRREQ = 17,
/// 数学参数超出作用域 Mathematics argument out of domain of function.
EDOM = 18,
/// 保留使用 Reserved
EDQUOT = 19,
/// 文件已存在 File exists.
EEXIST = 20,
/// 错误的地址 Bad address
EFAULT = 21,
/// 文件太大 File too large.
EFBIG = 22,
/// 主机不可达 Host is unreachable.
EHOSTUNREACH = 23,
/// 标志符被移除 Identifier removed.
EIDRM = 24,
/// 不合法的字符序列 Illegal byte sequence.
EILSEQ = 25,
/// 操作正在处理 Operation in progress.
EINPROGRESS = 26,
/// 被中断的函数 Interrupted function.
EINTR = 27,
/// 不可用的参数 Invalid argument.
EINVAL = 28,
/// I/O错误 I/O error.
EIO = 29,
/// 套接字已连接 Socket is connected.
EISCONN = 30,
/// 是一个目录 Is a directory
EISDIR = 31,
/// 符号链接级别过多 Too many levels of symbolic links.
ELOOP = 32,
/// 文件描述符的值过大 File descriptor value too large.
EMFILE = 33,
/// 链接数过多 Too many links.
EMLINK = 34,
/// 消息过大 Message too large.
EMSGSIZE = 35,
/// 保留使用 Reserved.
EMULTIHOP = 36,
/// 文件名过长 Filename too long.
ENAMETOOLONG = 37,
/// 网络已关闭 Network is down.
ENETDOWN = 38,
/// 网络连接已断开 Connection aborted by network.
ENETRESET = 39,
/// 网络不可达 Network unreachable.
ENETUNREACH = 40,
/// 系统中打开的文件过多 Too many files open in system.
ENFILE = 41,
/// 缓冲区空间不足 No buffer space available.
ENOBUFS = 42,
/// 队列头没有可读取的消息 No message is available on the STREAM head read queue.
ENODATA = 43,
/// 没有指定的设备 No such device.
ENODEV = 44,
/// 没有指定的文件或目录 No such file or directory.
ENOENT = 45,
/// 可执行文件格式错误 Executable file format error
ENOEXEC = 46,
/// 没有可用的锁 No locks available.
ENOLCK = 47,
/// 保留 Reserved.
ENOLINK = 48,
/// 没有足够的空间 Not enough space.
ENOMEM = 49,
/// 没有期待类型的消息 No message of the desired type.
ENOMSG = 50,
/// 协议不可用 Protocol not available.
ENOPROTOOPT = 51,
/// 设备上没有空间 No space left on device.
ENOSPC = 52,
/// 没有STREAM资源 No STREAM resources.
ENOSR = 53,
/// 不是STREAM Not a STREAM
ENOSTR = 54,
/// 功能不支持 Function not supported.
ENOSYS = 55,
/// 套接字未连接 The socket is not connected.
ENOTCONN = 56,
/// 不是目录 Not a directory.
ENOTDIR = 57,
/// 目录非空 Directory not empty.
ENOTEMPTY = 58,
/// 状态不可恢复 State not recoverable.
ENOTRECOVERABLE = 59,
/// 不是一个套接字 Not a socket.
ENOTSOCK = 60,
/// 不被支持 Not supported (may be the same value as [EOPNOTSUPP]).
ENOTSUP = 61,
/// 不正确的I/O控制操作 Inappropriate I/O control operation.
ENOTTY = 62,
/// 没有这样的设备或地址 No such device or address.
ENXIO = 63,
/// 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]).
EOPNOTSUPP = 64,
/// 数值过大,产生溢出 Value too large to be stored in data type.
EOVERFLOW = 65,
/// 之前的拥有者挂了 Previous owner died.
EOWNERDEAD = 66,
/// 操作不被允许 Operation not permitted.
EPERM = 67,
/// 断开的管道 Broken pipe.
EPIPE = 68,
/// 协议错误 Protocol error.
EPROTO = 69,
/// 协议不被支持 Protocol not supported.
EPROTONOSUPPORT = 70,
/// 对于套接字而言,错误的协议 Protocol wrong type for socket.
EPROTOTYPE = 71,
/// 结果过大 Result too large.
ERANGE = 72,
/// 只读的文件系统 Read-only file system.
EROFS = 73,
/// 错误的寻道.当前文件是pipe不允许seek请求 Invalid seek.
ESPIPE = 74,
EPERM = 1,
/// 没有指定的文件或目录 No such file or directory.
ENOENT = 2,
/// 没有这样的进程 No such process.
ESRCH = 75,
/// 保留 Reserved.
ESTALE = 76,
/// 流式ioctl()超时 Stream ioctl() timeout
ETIME = 77,
/// 连接超时 Connection timed out.
ETIMEDOUT = 78,
/// 文本文件忙 Text file busy.
ETXTBSY = 79,
/// 操作将被禁止 Operation would block (may be the same value as [EAGAIN]).
EWOULDBLOCK = 80,
ESRCH = 3,
/// 被中断的函数 Interrupted function.
EINTR = 4,
/// I/O错误 I/O error.
EIO = 5,
/// 没有这样的设备或地址 No such device or address.
ENXIO = 6,
/// 参数列表过长或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long.
E2BIG = 7,
/// 可执行文件格式错误 Executable file format error
ENOEXEC = 8,
/// 错误的文件描述符 Bad file descriptor.
EBADF = 9,
/// 没有子进程 No child processes.
ECHILD = 10,
/// 资源不可用,请重试。 Resource unavailable, try again.(may be the same value as [EWOULDBLOCK])
///
/// 操作将被禁止 Operation would block.(may be the same value as [EAGAIN]).
EAGAIN_OR_EWOULDBLOCK = 11,
/// 没有足够的空间 Not enough space.
ENOMEM = 12,
/// 访问被拒绝 Permission denied
EACCES = 13,
/// 错误的地址 Bad address
EFAULT = 14,
/// 需要块设备 Block device required
ENOTBLK = 15,
/// 设备或资源忙 Device or resource busy.
EBUSY = 16,
/// 文件已存在 File exists.
EEXIST = 17,
/// 跨设备连接 Cross-device link.
EXDEV = 81,
EXDEV = 18,
/// 没有指定的设备 No such device.
ENODEV = 19,
/// 不是目录 Not a directory.
ENOTDIR = 20,
/// 是一个目录 Is a directory
EISDIR = 21,
/// 不可用的参数 Invalid argument.
EINVAL = 22,
/// 系统中打开的文件过多 Too many files open in system.
ENFILE = 23,
/// 文件描述符的值过大 File descriptor value too large.
EMFILE = 24,
/// 不正确的I/O控制操作 Inappropriate I/O control operation.
ENOTTY = 25,
/// 文本文件忙 Text file busy.
ETXTBSY = 26,
/// 文件太大 File too large.
EFBIG = 27,
/// 设备上没有空间 No space left on device.
ENOSPC = 28,
/// 错误的寻道.当前文件是pipe不允许seek请求 Invalid seek.
ESPIPE = 29,
/// 只读的文件系统 Read-only file system.
EROFS = 30,
/// 链接数过多 Too many links.
EMLINK = 31,
/// 断开的管道 Broken pipe.
EPIPE = 32,
/// 数学参数超出作用域 Mathematics argument out of domain of function.
EDOM = 33,
/// 结果过大 Result too large.
ERANGE = 34,
/// 资源死锁将要发生 Resource deadlock would occur.
EDEADLK = 35,
/// 文件名过长 Filename too long.
ENAMETOOLONG = 36,
/// 没有可用的锁 No locks available.
ENOLCK = 37,
/// 功能不支持 Function not supported.
ENOSYS = 38,
/// 目录非空 Directory not empty.
ENOTEMPTY = 39,
/// 符号链接级别过多 Too many levels of symbolic links.
ELOOP = 40,
/// 没有期待类型的消息 No message of the desired type.
ENOMSG = 41,
/// 标志符被移除 Identifier removed.
EIDRM = 42,
/// 通道号超出范围 Channel number out of range
ECHRNG = 43,
/// 二级不同步 Level 2 not synchronized
EL2NSYNC = 44,
/// 三级暂停 Level 3 halted
EL3HLT = 45,
/// 三级重置 Level 3 reset
EL3RST = 46,
/// 链接号超出范围 Link number out of range
ELNRNG = 47,
/// 未连接协议驱动程序 Protocol driver not attached
EUNATCH = 48,
/// 没有可用的CSI结构 No CSI structure available
ENOCSI = 49,
/// 二级暂停 Level 2 halted
EL2HLT = 50,
/// 无效交换 Invalid exchange
EBADE = 51,
/// 无效的请求描述符 Invalid request descriptor
EBADR = 52,
/// 交换满 Exchange full
EXFULL = 53,
/// 无阳极 No anode
ENOANO = 54,
/// 请求码无效 Invalid request code
EBADRQC = 55,
/// 无效插槽 Invalid slot
EBADSLT = 56,
/// 资源死锁 Resource deadlock would occur
EDEADLOCK = 57,
/// 错误的字体文件格式 Bad font file format
EBFONT = 58,
/// 不是STREAM Not a STREAM
ENOSTR = 59,
/// 队列头没有可读取的消息 No message is available on the STREAM head read queue.
ENODATA = 60,
/// 流式ioctl()超时 Stream ioctl() timeout
ETIME = 61,
/// 没有STREAM资源 No STREAM resources.
ENOSR = 62,
/// 机器不在网络上 Machine is not on the network
ENONET = 63,
/// 未安装软件包 Package not installed
ENOPKG = 64,
/// 远程对象 Object is remote
EREMOTE = 65,
/// 保留 Reserved.
ENOLINK = 66,
/// 外设错误 Advertise error.
EADV = 67,
/// 安装错误 Srmount error
ESRMNT = 68,
/// 发送时发生通信错误 Communication error on send
ECOMM = 69,
/// 协议错误 Protocol error.
EPROTO = 70,
/// 保留使用 Reserved.
EMULTIHOP = 71,
/// RFS特定错误 RFS specific error
EDOTDOT = 72,
/// 错误的消息 Bad message.
EBADMSG = 73,
/// 数值过大,产生溢出 Value too large to be stored in data type.
EOVERFLOW = 74,
/// 名称在网络上不是唯一的 Name not unique on network
ENOTUNIQ = 75,
/// 处于不良状态的文件描述符 File descriptor in bad state
EBADFD = 76,
/// 远程地址已更改 Remote address changed
EREMCHG = 77,
/// 无法访问所需的共享库 Can not access a needed shared library
ELIBACC = 78,
/// 访问损坏的共享库 Accessing a corrupted shared library
ELIBBAD = 79,
/// a. out中的.lib部分已损坏 .lib section in a.out corrupted
ELIBSCN = 80,
/// 尝试链接太多共享库 Attempting to link in too many shared libraries
ELIBMAX = 81,
/// 无法直接执行共享库 Cannot exec a shared library directly
ELIBEXEC = 82,
/// 不合法的字符序列 Illegal byte sequence.
EILSEQ = 83,
/// 中断的系统调用应该重新启动 Interrupted system call should be restarted
ERESTART = 84,
/// 流管道错误 Streams pipe error
ESTRPIPE = 85,
/// 用户太多 Too many users
EUSERS = 86,
/// 不是一个套接字 Not a socket.
ENOTSOCK = 87,
/// 需要目标地址 Destination address required.
EDESTADDRREQ = 88,
/// 消息过大 Message too large.
EMSGSIZE = 89,
/// 对于套接字而言,错误的协议 Protocol wrong type for socket.
EPROTOTYPE = 90,
/// 协议不可用 Protocol not available.
ENOPROTOOPT = 91,
/// 协议不被支持 Protocol not supported.
EPROTONOSUPPORT = 92,
/// 不支持套接字类型 Socket type not supported
ESOCKTNOSUPPORT = 93,
/// 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]).
///
/// 不被支持 Not supported (may be the same value as [EOPNOTSUPP]).
EOPNOTSUPP_OR_ENOTSUP = 94,
/// 不支持协议系列 Protocol family not supported
EPFNOSUPPORT = 95,
/// 地址family不支持 Address family not supported.
EAFNOSUPPORT = 96,
/// 地址正在被使用 Address in use.
EADDRINUSE = 97,
/// 地址不可用 Address not available.
EADDRNOTAVAIL = 98,
/// 网络已关闭 Network is down.
ENETDOWN = 99,
/// 网络不可达 Network unreachable.
ENETUNREACH = 100,
/// 网络连接已断开 Connection aborted by network.
ENETRESET = 101,
/// 连接已断开 Connection aborted.
ECONNABORTED = 102,
/// 连接被重置 Connection reset.
ECONNRESET = 103,
/// 缓冲区空间不足 No buffer space available.
ENOBUFS = 104,
/// 套接字已连接 Socket is connected.
EISCONN = 105,
/// 套接字未连接 The socket is not connected.
ENOTCONN = 106,
/// 传输端点关闭后无法发送 Cannot send after transport endpoint shutdown
ESHUTDOWN = 107,
/// 引用太多:无法拼接 Too many references: cannot splice
ETOOMANYREFS = 108,
/// 连接超时 Connection timed out.
ETIMEDOUT = 109,
/// 连接被拒绝 Connection refused.
ECONNREFUSED = 110,
/// 主机已关闭 Host is down
EHOSTDOWN = 111,
/// 主机不可达 Host is unreachable.
EHOSTUNREACH = 112,
/// 连接已经在处理 Connection already in progress.
EALREADY = 113,
/// 操作正在处理 Operation in progress.
EINPROGRESS = 114,
/// 保留 Reserved.
ESTALE = 115,
/// 结构需要清理 Structure needs cleaning
EUCLEAN = 116,
/// 不是XENIX命名类型文件 Not a XENIX named type file
ENOTNAM = 117,
/// 没有可用的XENIX信号量 No XENIX semaphores available
ENAVAIL = 118,
/// 是命名类型文件 Is a named type file
EISNAM = 119,
/// 远程I/O错误 Remote I/O error
EREMOTEIO = 120,
/// 保留使用 Reserved
EDQUOT = 121,
/// 没有找到媒介 No medium found
ENOMEDIUM = 122,
/// 介质类型错误 Wrong medium type
EMEDIUMTYPE = 123,
/// 操作被取消 Operation canceled.
ECANCELED = 124,
/// 所需的密钥不可用 Required key not available
ENOKEY = 125,
/// 密钥已过期 Key has expired
EKEYEXPIRED = 126,
/// 密钥已被撤销 Key has been revoked
EKEYREVOKED = 127,
/// 密钥被服务拒绝 Key has been revoked
EKEYREJECTED = 128,
/// 之前的拥有者挂了 Previous owner died.
EOWNERDEAD = 129,
/// 状态不可恢复 State not recoverable.
ENOTRECOVERABLE = 130,
}
impl SystemError {

View File

@ -240,7 +240,7 @@ pub fn timer_get_first_expire() -> Result<u64, SystemError> {
Err(_) => continue,
}
}
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
pub fn update_timer_jiffies(add_jiffies: u64) -> u64 {

View File

@ -15,95 +15,138 @@ extern "C"
{
#endif
#define E2BIG 1 /* 参数列表过长或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long. */
#define EACCES 2 /* 访问被拒绝 Permission denied */
#define EADDRINUSE 3 /* 地址正在被使用 Address in use.*/
#define EADDRNOTAVAIL 4 /* 地址不可用 Address not available.*/
#define EAFNOSUPPORT 5 /* 地址family不支持 Address family not supported. */
#define EAGAIN 6 /* 资源不可用,请重试。 Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).*/
#define EALREADY 7 /* 连接已经在处理 Connection already in progress. */
#define EBADF 8 /* 错误的文件描述符 Bad file descriptor. */
#define EBADMSG 9 /* 错误的消息 Bad message. */
#define EBUSY 10 /* 设备或资源忙 Device or resource busy. */
#define ECANCELED 11 /* 操作被取消 Operation canceled. */
#define ECHILD 12 /* 没有子进程 No child processes. */
#define ECONNABORTED 13 /* 连接已断开 Connection aborted. */
#define ECONNREFUSED 14 /* 连接被拒绝 Connection refused. */
#define ECONNRESET 15 /* 连接被重置 Connection reset. */
#define EDEADLK 16 /* 资源死锁将要发生 Resource deadlock would occur. */
#define EDESTADDRREQ 17 /* 需要目标地址 Destination address required.*/
#define EDOM 18 /* 数学参数超出作用域 Mathematics argument out of domain of function. */
#define EDQUOT 19 /* 保留使用 Reserved */
#define EEXIST 20 /* 文件已存在 File exists. */
#define EFAULT 21 /* 错误的地址 Bad address */
#define EFBIG 22 /* 文件太大 File too large. */
#define EHOSTUNREACH 23 /* 主机不可达 Host is unreachable.*/
#define EIDRM 24 /* 标志符被移除 Identifier removed. */
#define EILSEQ 25 /* 不合法的字符序列 Illegal byte sequence. */
#define EINPROGRESS 26 /* 操作正在处理 Operation in progress. */
#define EINTR 27 /* 被中断的函数 Interrupted function. */
#define EINVAL 28 /* 不可用的参数 Invalid argument. */
#define EIO 29 /* I/O错误 I/O error. */
#define EISCONN 30 /* 套接字已连接 Socket is connected. */
#define EISDIR 31 /* 是一个目录 Is a directory */
#define ELOOP 32 /* 符号链接级别过多 Too many levels of symbolic links. */
#define EMFILE 33 /* 文件描述符的值过大 File descriptor value too large. */
#define EMLINK 34 /* 链接数过多 Too many links. */
#define EMSGSIZE 35 /* 消息过大 Message too large. */
#define EMULTIHOP 36 /* 保留使用 Reserved. */
#define ENAMETOOLONG 37 /* 文件名过长 Filename too long. */
#define ENETDOWN 38 /* 网络已关闭 Network is down. */
#define ENETRESET 39 /* 网络连接已断开 Connection aborted by network. */
#define ENETUNREACH 40 /* 网络不可达 Network unreachable. */
#define ENFILE 41 /* 系统中打开的文件过多 Too many files open in system.*/
#define ENOBUFS 42 /* 缓冲区空间不足 No buffer space available. */
#define ENODATA 43 /* 队列头没有可读取的消息 No message is available on the STREAM head read queue. */
#define ENODEV 44 /* 没有指定的设备 No such device. */
#define ENOENT 45 /* 没有指定的文件或目录 No such file or directory. */
#define ENOEXEC 46 /* 可执行文件格式错误 Executable file format error. */
#define ENOLCK 47 /* 没有可用的锁 No locks available. */
#define ENOLINK 48 /* 保留 Reserved. */
#define ENOMEM 49 /* 没有足够的空间 Not enough space. */
#define ENOMSG 50 /* 没有期待类型的消息 No message of the desired type. */
#define ENOPROTOOPT 51 /* 协议不可用 Protocol not available. */
#define ENOSPC 52 /* 设备上没有空间 No space left on device. */
#define ENOSR 53 /* 没有STREAM资源 No STREAM resources.*/
#define ENOSTR 54 /* 不是STREAM Not a STREAM */
#define ENOSYS 55 /* 功能不支持 Function not supported. */
#define ENOTCONN 56 /* 套接字未连接 The socket is not connected. */
#define ENOTDIR 57 /* 不是目录 Not a directory. */
#define ENOTEMPTY 58 /* 目录非空 Directory not empty. */
#define ENOTRECOVERABLE 59 /* 状态不可恢复 State not recoverable. */
#define ENOTSOCK 60 /* 不是一个套接字 Not a socket.*/
#define ENOTSUP 61 /* 不被支持 Not supported (may be the same value as [EOPNOTSUPP]). */
#define ENOTTY 62 /* 不正确的I/O控制操作 Inappropriate I/O control operation. */
#define ENXIO 63 /* 没有这样的设备或地址 No such device or address. */
#define EOPNOTSUPP 64 /* 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]). */
#define EOVERFLOW 65 /* 数值过大,产生溢出 Value too large to be stored in data type. */
#define EOWNERDEAD 66 /* 之前的拥有者挂了 Previous owner died. */
#define EPERM 67 /* 操作不被允许 Operation not permitted. */
#define EPIPE 68 /* 断开的管道 Broken pipe. */
#define EPROTO 69 /* 协议错误 Protocol error. */
#define EPROTONOSUPPORT 70 /* 协议不被支持 Protocol not supported. */
#define EPROTOTYPE 71 /* 对于套接字而言,错误的协议 Protocol wrong type for socket. */
#define ERANGE 72 /* 结果过大 Result too large. */
#define EROFS 73 /* 只读的文件系统 Read-only file system. */
#define ESPIPE 74 /* 错误的寻道.当前文件是pipe不允许seek请求 Invalid seek. */
#define ESRCH 75 /* 没有这样的进程 No such process. */
#define ESTALE 76 /* 保留 Reserved. */
#define ETIME 77 /* 流式ioctl()超时 Stream ioctl() timeout */
#define ETIMEDOUT 78 /* 连接超时 Connection timed out.*/
#define ETXTBSY 79 /* 文本文件忙 Text file busy. */
#define EWOULDBLOCK 80 /* 操作将被禁止 Operation would block (may be the same value as [EAGAIN]). */
#define EXDEV 81 /* 跨设备连接 Cross-device link. */
#define EPERM 1 /* 操作不被允许 Operation not permitted. */
#define ENOENT 2 /* 没有指定的文件或目录 No such file or directory. */
#define ESRCH 3 /* 没有这样的进程 No such process. */
#define EINTR 4 /* 被中断的函数 Interrupted function. */
#define EIO 5 /* I/O错误 I/O error. */
#define ENXIO 6 /* 没有这样的设备或地址 No such device or address. */
#define E2BIG 7 /* 参数列表过长或者在输出buffer中缺少空间 或者参数比系统内建的最大值要大 Argument list too long. */
#define ENOEXEC 8 /* 可执行文件格式错误 Executable file format error */
#define EBADF 9 /* 错误的文件描述符 Bad file descriptor. */
#define ECHILD 10 /* 没有子进程 No child processes. */
#define EAGAIN 11 /* 资源不可用,请重试。 Resource unavailable try again.(may be the same value as [EWOULDBLOCK]) */
#define EWOULDBLOCK 11 /* 操作将被禁止 Operation would block.(may be the same value as [EAGAIN]). */
#define ENOMEM 12 /* 没有足够的空间 Not enough space. */
#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 /* 系统中打开的文件过多 Too many files open in system. */
#define EMFILE 24 /* 文件描述符的值过大 File descriptor value too large. */
#define ENOTTY 25 /* 不正确的I/O控制操作 Inappropriate I/O control operation. */
#define ETXTBSY 26 /* 文本文件忙 Text file busy. */
#define EFBIG 27 /* 文件太大 File too large. */
#define ENOSPC 28 /* 设备上没有空间 No space left on device. */
#define ESPIPE 29 /* 错误的寻道.当前文件是pipe不允许seek请求 Invalid seek. */
#define EROFS 30 /* 只读的文件系统 Read-only file system. */
#define EMLINK 31 /* 链接数过多 Too many links. */
#define EPIPE 32 /* 断开的管道 Broken pipe. */
#define EDOM 33 /* 数学参数超出作用域 Mathematics argument out of domain of function. */
#define ERANGE 34 /* 结果过大 Result too large. */
#define EDEADLK 35 /* 资源死锁将要发生 Resource deadlock would occur. */
#define ENAMETOOLONG 36 /* 文件名过长 Filename too long. */
#define ENOLCK 37 /* 没有可用的锁 No locks available. */
#define ENOSYS 38 /* 功能不支持 Function not supported. */
#define ENOTEMPTY 39 /* 目录非空 Directory not empty. */
#define ELOOP 40 /* 符号链接级别过多 Too many levels of symbolic links. */
#define ENOMSG 41 /* 没有期待类型的消息 No message of the desired type. */
#define EIDRM 42 /* 标志符被移除 Identifier removed. */
#define ECHRNG 43 /* 通道号超出范围 Channel number out of range */
#define EL2NSYNC 44 /* 二级不同步 Level 2 not synchronized */
#define EL3HLT 45 /* 三级暂停 Level 3 halted */
#define EL3RST 46 /* 三级重置 Level 3 reset */
#define ELNRNG 47 /* 链接号超出范围 Link number out of range */
#define EUNATCH 48 /* 未连接协议驱动程序 Protocol driver not attached */
#define ENOCSI 49 /* 没有可用的CSI结构 No CSI structure available */
#define EL2HLT 50 /* 二级暂停 Level 2 halted */
#define EBADE 51 /* 无效交换 Invalid exchange */
#define EBADR 52 /* 无效的请求描述符 Invalid request descriptor */
#define EXFULL 53 /* 交换满 Exchange full */
#define ENOANO 54 /* 无阳极 No anode */
#define EBADRQC 55 /* 请求码无效 Invalid request code */
#define EBADSLT 56 /* 无效插槽 Invalid slot */
#define EDEADLOCK 57 /* 资源死锁 Resource deadlock would occur */
#define EBFONT 58 /* 错误的字体文件格式 Bad font file format */
#define ENOSTR 59 /* 不是STREAM Not a STREAM */
#define ENODATA 60 /* 队列头没有可读取的消息 No message is available on the STREAM head read queue. */
#define ETIME 61 /* 流式ioctl()超时 Stream ioctl() timeout */
#define ENOSR 62 /* 没有STREAM资源 No STREAM resources. */
#define ENONET 63 /* 机器不在网络上 Machine is not on the network */
#define ENOPKG 64 /* 未安装软件包 Package not installed */
#define EREMOTE 65 /* 远程对象 Object is remote */
#define ENOLINK 66 /* 保留 Reserved. */
#define EADV 67 /* 外设错误 Advertise error. */
#define ESRMNT 68 /* 安装错误 Srmount error */
#define ECOMM 69 /* 发送时发生通信错误 Communication error on send */
#define EPROTO 70 /* 协议错误 Protocol error. */
#define EMULTIHOP 71 /* 保留使用 Reserved. */
#define EDOTDOT 72 /* RFS特定错误 RFS specific error */
#define EBADMSG 73 /* 错误的消息 Bad message. */
#define EOVERFLOW 74 /* 数值过大,产生溢出 Value too large to be stored in data type. */
#define ENOTUNIQ 75 /* 名称在网络上不是唯一的 Name not unique on network */
#define EBADFD 76 /* 处于不良状态的文件描述符 File descriptor in bad state */
#define EREMCHG 77 /* 远程地址已更改 Remote address changed */
#define ELIBACC 78 /* 无法访问所需的共享库 Can not access a needed shared library */
#define ELIBBAD 79 /* 访问损坏的共享库 Accessing a corrupted shared library */
#define ELIBSCN 80 /* a. out中的.lib部分已损坏 .lib section in a.out corrupted */
#define ELIBMAX 81 /* 尝试链接太多共享库 Attempting to link in too many shared libraries */
#define ELIBEXEC 82 /* 无法直接执行共享库 Cannot exec a shared library directly */
#define EILSEQ 83 /* 不合法的字符序列 Illegal byte sequence. */
#define ERESTART 84 /* 中断的系统调用应该重新启动 Interrupted system call should be restarted */
#define ESTRPIPE 85 /* 流管道错误 Streams pipe error */
#define EUSERS 86 /* 用户太多 Too many users */
#define ENOTSOCK 87 /* 不是一个套接字 Not a socket. */
#define EDESTADDRREQ 88 /* 需要目标地址 Destination address required. */
#define EMSGSIZE 89 /* 消息过大 Message too large. */
#define EPROTOTYPE 90 /* 对于套接字而言,错误的协议 Protocol wrong type for socket. */
#define ENOPROTOOPT 91 /* 协议不可用 Protocol not available. */
#define EPROTONOSUPPORT 92 /* 协议不被支持 Protocol not supported. */
#define ESOCKTNOSUPPORT 93 /* 不支持套接字类型 Socket type not supported */
#define EOPNOTSUPP 94 /* 套接字不支持该操作 Operation not supported on socket (may be the same value as [ENOTSUP]). */
#define ENOTSUP 94 /* 不被支持 Not supported (may be the same value as [EOPNOTSUPP]). */
#define EPFNOSUPPORT 95 /* 不支持协议系列 Protocol family not supported */
#define EAFNOSUPPORT 96 /* 地址family不支持 Address family not supported. */
#define EADDRINUSE 97 /* 地址正在被使用 Address in use. */
#define EADDRNOTAVAIL 98 /* 地址不可用 Address not available. */
#define ENETDOWN 99 /* 网络已关闭 Network is down. */
#define ENETUNREACH 100 /* 网络不可达 Network unreachable. */
#define ENETRESET 101 /* 网络连接已断开 Connection aborted by network. */
#define ECONNABORTED 102 /* 连接已断开 Connection aborted. */
#define ECONNRESET 103 /* 连接被重置 Connection reset. */
#define ENOBUFS 104 /* 缓冲区空间不足 No buffer space available. */
#define EISCONN 105 /* 套接字已连接 Socket is connected. */
#define ENOTCONN 106 /* 套接字未连接 The socket is not connected. */
#define ESHUTDOWN 107 /* 传输端点关闭后无法发送 Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 108 /* 引用太多:无法拼接 Too many references: cannot splice */
#define ETIMEDOUT 109 /* 连接超时 Connection timed out. */
#define ECONNREFUSED 110 /* 连接被拒绝 Connection refused. */
#define EHOSTDOWN 111 /* 主机已关闭 Host is down */
#define EHOSTUNREACH 112 /* 主机不可达 Host is unreachable. */
#define EALREADY 113 /* 连接已经在处理 Connection already in progress. */
#define EINPROGRESS 114 /* 操作正在处理 Operation in progress. */
#define ESTALE 115 /* 保留 Reserved. */
#define EUCLEAN 116 /* 结构需要清理 Structure needs cleaning */
#define ENOTNAM 117 /* 不是XENIX命名类型文件 Not a XENIX named type file */
#define ENAVAIL 118 /* 没有可用的XENIX信号量 No XENIX semaphores available */
#define EISNAM 119 /* 是命名类型文件 Is a named type file */
#define EREMOTEIO 120 /* 远程I/O错误 Remote I/O error */
#define EDQUOT 121 /* 保留使用 Reserved */
#define ENOMEDIUM 122 /* 没有找到媒介 No medium found */
#define EMEDIUMTYPE 123 /* 介质类型错误 Wrong medium type */
#define ECANCELED 124 /* 操作被取消 Operation canceled. */
#define ENOKEY 125 /* 所需的密钥不可用 Required key not available */
#define EKEYEXPIRED 126 /* 密钥已过期 Key has expired */
#define EKEYREVOKED 127 /* 密钥已被撤销 Key has been revoked */
#define EKEYREJECTED 128 /* 密钥被服务拒绝 Key has been revoked */
#define EOWNERDEAD 129 /* 之前的拥有者挂了 Previous owner died. */
#define ENOTRECOVERABLE 130 /* 状态不可恢复 State not recoverable. */
extern int errno;