RustForge

rust-kernel

Rustbelt: a hobby x86_64 kernel written in Rust

rust-kernel / src / errno.rs
1283 bytes ยท raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//! Error numbers, same values as Linux (`man 3 errno`). Syscalls return
//! `-errno` in rax on failure, like Linux does.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i64)]
pub enum Errno {
    ENOENT = 2,        // no such file or directory
    EIO = 5,           // input/output error (disk trouble)
    E2BIG = 7,         // argument list too long
    ENOEXEC = 8,       // not a valid executable
    EBADF = 9,         // bad file descriptor
    ECHILD = 10,       // no such child process (wait)
    ENOMEM = 12,       // out of memory
    EFAULT = 14,       // bad address (pointer not in user space / not mapped)
    EBUSY = 16,        // busy (e.g. removing a mount point)
    EEXIST = 17,       // file exists
    ENOTDIR = 20,      // a path component isn't a directory
    EISDIR = 21,       // is a directory
    EINVAL = 22,       // invalid argument
    EMFILE = 24,       // too many open files
    ENOSPC = 28,       // no space left on device
    ESPIPE = 29,       // can't seek (pipe, console)
    EPIPE = 32,        // writing to a pipe nobody reads
    ERANGE = 34,       // result doesn't fit (getcwd buffer too small)
    ENAMETOOLONG = 36, // path too long
    ENOSYS = 38,       // no such system call
    ENOTEMPTY = 39,    // directory not empty
}