Compare commits

..

4 Commits

5 changed files with 420 additions and 138 deletions

View File

@ -2,140 +2,275 @@
#[repr(i32)] #[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Errno { pub enum Errno {
/// Operation not permitted
EPERM = 1, EPERM = 1,
/// No such file or directory
ENOENT = 2, ENOENT = 2,
/// No such process
ESRCH = 3, ESRCH = 3,
/// Interrupted system call
EINTR = 4, EINTR = 4,
/// Input/output error
EIO = 5, EIO = 5,
/// No such device or address
ENXIO = 6, ENXIO = 6,
/// Argument list too long
E2BIG = 7, E2BIG = 7,
/// Exec format error
ENOEXEC = 8, ENOEXEC = 8,
/// Bad file descriptor
EBADF = 9, EBADF = 9,
/// No child processes
ECHILD = 10, ECHILD = 10,
/// Resource temporarily unavailable
EWOULDBLOCK = 11, EWOULDBLOCK = 11,
/// Cannot allocate memory
ENOMEM = 12, ENOMEM = 12,
/// Permission denied
EACCES = 13, EACCES = 13,
/// Bad address
EFAULT = 14, EFAULT = 14,
/// Block device required
ENOTBLK = 15, ENOTBLK = 15,
/// Device or resource busy
EBUSY = 16, EBUSY = 16,
/// File exists
EEXIST = 17, EEXIST = 17,
/// Invalid cross-device link
EXDEV = 18, EXDEV = 18,
/// No such device
ENODEV = 19, ENODEV = 19,
/// Not a directory
ENOTDIR = 20, ENOTDIR = 20,
/// Is a directory
EISDIR = 21, EISDIR = 21,
/// Invalid argument
EINVAL = 22, EINVAL = 22,
/// Too many open files in system
ENFILE = 23, ENFILE = 23,
/// Too many open files
EMFILE = 24, EMFILE = 24,
/// Inappropriate ioctl for device
ENOTTY = 25, ENOTTY = 25,
/// Text file busy
ETXTBSY = 26, ETXTBSY = 26,
/// File too large
EFBIG = 27, EFBIG = 27,
/// No space left on device
ENOSPC = 28, ENOSPC = 28,
/// Illegal seek
ESPIPE = 29, ESPIPE = 29,
/// Read-only file system
EROFS = 30, EROFS = 30,
/// Too many links
EMLINK = 31, EMLINK = 31,
/// Broken pipe
EPIPE = 32, EPIPE = 32,
/// Numerical argument out of domain
EDOM = 33, EDOM = 33,
/// Numerical result out of range
ERANGE = 34, ERANGE = 34,
/// Resource deadlock avoided
EDEADLK = 35, EDEADLK = 35,
/// File name too long
ENAMETOOLONG = 36, ENAMETOOLONG = 36,
/// No locks available
ENOLCK = 37, ENOLCK = 37,
/// Function not implemented
ENOSYS = 38, ENOSYS = 38,
/// Directory not empty
ENOTEMPTY = 39, ENOTEMPTY = 39,
/// Too many levels of symbolic links
ELOOP = 40, ELOOP = 40,
/// No message of desired type
ENOMSG = 42, ENOMSG = 42,
/// Identifier removed
EIDRM = 43, EIDRM = 43,
/// Channel number out of range
ECHRNG = 44, ECHRNG = 44,
/// Level 2 not synchronized
EL2NSYNC = 45, EL2NSYNC = 45,
/// Level 3 halted
EL3HLT = 46, EL3HLT = 46,
/// Level 3 reset
EL3RST = 47, EL3RST = 47,
/// Link number out of range
ELNRNG = 48, ELNRNG = 48,
/// Protocol driver not attached
EUNATCH = 49, EUNATCH = 49,
/// No CSI structure available
ENOCSI = 50, ENOCSI = 50,
/// Level 2 halted
EL2HLT = 51, EL2HLT = 51,
/// Invalid exchange
EBADE = 52, EBADE = 52,
/// Invalid request descriptor
EBADR = 53, EBADR = 53,
/// Exchange full
EXFULL = 54, EXFULL = 54,
/// No anode
ENOANO = 55, ENOANO = 55,
/// Invalid request code
EBADRQC = 56, EBADRQC = 56,
/// Invalid slot
EBADSLT = 57, EBADSLT = 57,
/// Bad font file format
EBFONT = 59, EBFONT = 59,
/// Device not a stream
ENOSTR = 60, ENOSTR = 60,
/// No data available
ENODATA = 61, ENODATA = 61,
/// Timer expired
ETIME = 62, ETIME = 62,
/// Out of streams resources
ENOSR = 63, ENOSR = 63,
/// Machine is not on the network
ENONET = 64, ENONET = 64,
/// Package not installed
ENOPKG = 65, ENOPKG = 65,
/// Object is remote
EREMOTE = 66, EREMOTE = 66,
/// Link has been severed
ENOLINK = 67, ENOLINK = 67,
/// Advertise error
EADV = 68, EADV = 68,
/// Srmount error
ESRMNT = 69, ESRMNT = 69,
/// Communication error on send
ECOMM = 70, ECOMM = 70,
/// Protocol error
EPROTO = 71, EPROTO = 71,
/// Multihop attempted
EMULTIHOP = 72, EMULTIHOP = 72,
/// RFS specific error
EDOTDOT = 73, EDOTDOT = 73,
/// Bad message
EBADMSG = 74, EBADMSG = 74,
/// Value too large for defined data type
EOVERFLOW = 75, EOVERFLOW = 75,
/// Name not unique on network
ENOTUNIQ = 76, ENOTUNIQ = 76,
/// File descriptor in bad state
EBADFD = 77, EBADFD = 77,
/// Remote address changed
EREMCHG = 78, EREMCHG = 78,
/// Can not access a needed shared library
ELIBACC = 79, ELIBACC = 79,
/// Accessing a corrupted shared library
ELIBBAD = 80, ELIBBAD = 80,
/// .lib section in a.out corrupted
ELIBSCN = 81, ELIBSCN = 81,
/// Attempting to link in too many shared libraries
ELIBMAX = 82, ELIBMAX = 82,
/// Cannot exec a shared library directly
ELIBEXEC = 83, ELIBEXEC = 83,
/// Invalid or incomplete multibyte or wide character
EILSEQ = 84, EILSEQ = 84,
/// Interrupted system call should be restarted
ERESTART = 85, ERESTART = 85,
/// Streams pipe error
ESTRPIPE = 86, ESTRPIPE = 86,
/// Too many users
EUSERS = 87, EUSERS = 87,
/// Socket operation on non-socket
ENOTSOCK = 88, ENOTSOCK = 88,
/// Destination address required
EDESTADDRREQ = 89, EDESTADDRREQ = 89,
/// Message too long
EMSGSIZE = 90, EMSGSIZE = 90,
/// Protocol wrong type for socket
EPROTOTYPE = 91, EPROTOTYPE = 91,
/// Protocol not available
ENOPROTOOPT = 92, ENOPROTOOPT = 92,
/// Protocol not supported
EPROTONOSUPPORT = 93, EPROTONOSUPPORT = 93,
/// Socket type not supported
ESOCKTNOSUPPORT = 94, ESOCKTNOSUPPORT = 94,
/// Operation not supported
ENOTSUP = 95, ENOTSUP = 95,
/// Protocol family not supported
EPFNOSUPPORT = 96, EPFNOSUPPORT = 96,
/// Address family not supported by protocol
EAFNOSUPPORT = 97, EAFNOSUPPORT = 97,
/// Address already in use
EADDRINUSE = 98, EADDRINUSE = 98,
/// Cannot assign requested address
EADDRNOTAVAIL = 99, EADDRNOTAVAIL = 99,
/// Network is down
ENETDOWN = 100, ENETDOWN = 100,
/// Network is unreachable
ENETUNREACH = 101, ENETUNREACH = 101,
/// Network dropped connection on reset
ENETRESET = 102, ENETRESET = 102,
/// Software caused connection abort
ECONNABORTED = 103, ECONNABORTED = 103,
/// Connection reset by peer
ECONNRESET = 104, ECONNRESET = 104,
/// No buffer space available
ENOBUFS = 105, ENOBUFS = 105,
/// Transport endpoint is already connected
EISCONN = 106, EISCONN = 106,
/// Transport endpoint is not connected
ENOTCONN = 107, ENOTCONN = 107,
/// Cannot send after transport endpoint shutdown
ESHUTDOWN = 108, ESHUTDOWN = 108,
/// Too many references: cannot splice
ETOOMANYREFS = 109, ETOOMANYREFS = 109,
/// Connection timed out
ETIMEDOUT = 110, ETIMEDOUT = 110,
/// Connection refused
ECONNREFUSED = 111, ECONNREFUSED = 111,
/// Host is down
EHOSTDOWN = 112, EHOSTDOWN = 112,
/// No route to host
EHOSTUNREACH = 113, EHOSTUNREACH = 113,
/// Operation already in progress
EALREADY = 114, EALREADY = 114,
/// Operation now in progress
EINPROGRESS = 115, EINPROGRESS = 115,
/// Stale file handle
ESTALE = 116, ESTALE = 116,
/// Structure needs cleaning
EUCLEAN = 117, EUCLEAN = 117,
/// Not a XENIX named type file
ENOTNAM = 118, ENOTNAM = 118,
/// No XENIX semaphores available
ENAVAIL = 119, ENAVAIL = 119,
/// Is a named type file
EISNAM = 120, EISNAM = 120,
/// Remote I/O error
EREMOTEIO = 121, EREMOTEIO = 121,
/// Disk quota exceeded
EDQUOT = 122, EDQUOT = 122,
/// No medium found
ENOMEDIUM = 123, ENOMEDIUM = 123,
/// Wrong medium type
EMEDIUMTYPE = 124, EMEDIUMTYPE = 124,
/// Operation canceled
ECANCELED = 125, ECANCELED = 125,
/// Required key not available
ENOKEY = 126, ENOKEY = 126,
/// Key has expired
EKEYEXPIRED = 127, EKEYEXPIRED = 127,
/// Key has been revoked
EKEYREVOKED = 128, EKEYREVOKED = 128,
/// Key was rejected by service
EKEYREJECTED = 129, EKEYREJECTED = 129,
/// Owner died
EOWNERDEAD = 130, EOWNERDEAD = 130,
/// State not recoverable
ENOTRECOVERABLE = 131, ENOTRECOVERABLE = 131,
/// Operation not possible due to RF-kill
ERFKILL = 132, ERFKILL = 132,
/// Memory page has hardware error
EHWPOISON = 133, EHWPOISON = 133,
/// Resource temporarily unavailable
EAGAIN = 134, EAGAIN = 134,
/// Unexpected EOF
EEOF = 135, EEOF = 135,
/// Invalid data
EINVALDAT = 136, EINVALDAT = 136,
/// Write zero
EWRZERO = 137, EWRZERO = 137,
} }
@ -327,141 +462,141 @@ impl crate::fmt::Display for Errno {
fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> Result<(), crate::fmt::Error> { fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> Result<(), crate::fmt::Error> {
use Errno::*; use Errno::*;
let errno_name = match self { let errno_name = match self {
EPERM => "Operation not permitted", EPERM => "EPERM",
ENOENT => "No such file or directory", ENOENT => "ENOENT",
ESRCH => "No such process", ESRCH => "ESRCH",
EINTR => "Interrupted system call", EINTR => "EINTR",
EIO => "Input/output error", EIO => "EIO",
ENXIO => "No such device or address", ENXIO => "ENXIO",
E2BIG => "Argument list too long", E2BIG => "E2BIG",
ENOEXEC => "Exec format error", ENOEXEC => "ENOEXEC",
EBADF => "Bad file descriptor", EBADF => "EBADF",
ECHILD => "No child processes", ECHILD => "ECHILD",
EAGAIN => "Resource temporarily unavailable", EAGAIN => "EAGAIN",
EWOULDBLOCK => "Resource temporarily unavailable", EWOULDBLOCK => "EWOULDBLOCK",
ENOMEM => "Cannot allocate memory", ENOMEM => "ENOMEM",
EACCES => "Permission denied", EACCES => "EACCES",
EFAULT => "Bad address", EFAULT => "EFAULT",
ENOTBLK => "Block device required", ENOTBLK => "ENOTBLK",
EBUSY => "Device or resource busy", EBUSY => "EBUSY",
EEXIST => "File exists", EEXIST => "EEXIST",
EXDEV => "Invalid cross-device link", EXDEV => "EXDEV",
ENODEV => "No such device", ENODEV => "ENODEV",
ENOTDIR => "Not a directory", ENOTDIR => "ENOTDIR",
EISDIR => "Is a directory", EISDIR => "EISDIR",
EINVAL => "Invalid argument", EINVAL => "EINVAL",
ENFILE => "Too many open files in system", ENFILE => "ENFILE",
EMFILE => "Too many open files", EMFILE => "EMFILE",
ENOTTY => "Inappropriate ioctl for device", ENOTTY => "ENOTTY",
ETXTBSY => "Text file busy", ETXTBSY => "ETXTBSY",
EFBIG => "File too large", EFBIG => "EFBIG",
ENOSPC => "No space left on device", ENOSPC => "ENOSPC",
ESPIPE => "Illegal seek", ESPIPE => "ESPIPE",
EROFS => "Read-only file system", EROFS => "EROFS",
EMLINK => "Too many links", EMLINK => "EMLINK",
EPIPE => "Broken pipe", EPIPE => "EPIPE",
EDOM => "Numerical argument out of domain", EDOM => "EDOM",
ERANGE => "Numerical result out of range", ERANGE => "ERANGE",
EDEADLK => "Resource deadlock avoided", EDEADLK => "EDEADLK",
ENAMETOOLONG => "File name too long", ENAMETOOLONG => "ENAMETOOLONG",
ENOLCK => "No locks available", ENOLCK => "ENOLCK",
ENOSYS => "Function not implemented", ENOSYS => "ENOSYS",
ENOTEMPTY => "Directory not empty", ENOTEMPTY => "ENOTEMPTY",
ELOOP => "Too many levels of symbolic links", ELOOP => "ELOOP",
ENOMSG => "No message of desired type", ENOMSG => "ENOMSG",
EIDRM => "Identifier removed", EIDRM => "EIDRM",
ECHRNG => "Channel number out of range", ECHRNG => "ECHRNG",
EL2NSYNC => "Level 2 not synchronized", EL2NSYNC => "EL2NSYNC",
EL3HLT => "Level 3 halted", EL3HLT => "EL3HLT",
EL3RST => "Level 3 reset", EL3RST => "EL3RST",
ELNRNG => "Link number out of range", ELNRNG => "ELNRNG",
EUNATCH => "Protocol driver not attached", EUNATCH => "EUNATCH",
ENOCSI => "No CSI structure available", ENOCSI => "ENOCSI",
EL2HLT => "Level 2 halted", EL2HLT => "EL2HLT",
EBADE => "Invalid exchange", EBADE => "EBADE",
EBADR => "Invalid request descriptor", EBADR => "EBADR",
EXFULL => "Exchange full", EXFULL => "EXFULL",
ENOANO => "No anode", ENOANO => "ENOANO",
EBADRQC => "Invalid request code", EBADRQC => "EBADRQC",
EBADSLT => "Invalid slot", EBADSLT => "EBADSLT",
EBFONT => "Bad font file format", EBFONT => "EBFONT",
ENOSTR => "Device not a stream", ENOSTR => "ENOSTR",
ENODATA => "No data available", ENODATA => "ENODATA",
ETIME => "Timer expired", ETIME => "ETIME",
ENOSR => "Out of streams resources", ENOSR => "ENOSR",
ENONET => "Machine is not on the network", ENONET => "ENONET",
ENOPKG => "Package not installed", ENOPKG => "ENOPKG",
EREMOTE => "Object is remote", EREMOTE => "EREMOTE",
ENOLINK => "Link has been severed", ENOLINK => "ENOLINK",
EADV => "Advertise error", EADV => "EADV",
ESRMNT => "Srmount error", ESRMNT => "ESRMNT",
ECOMM => "Communication error on send", ECOMM => "ECOMM",
EPROTO => "Protocol error", EPROTO => "EPROTO",
EMULTIHOP => "Multihop attempted", EMULTIHOP => "EMULTIHOP",
EDOTDOT => "RFS specific error", EDOTDOT => "EDOTDOT",
EBADMSG => "Bad message", EBADMSG => "EBADMSG",
EOVERFLOW => "Value too large for defined data type", EOVERFLOW => "EOVERFLOW",
ENOTUNIQ => "Name not unique on network", ENOTUNIQ => "ENOTUNIQ",
EBADFD => "File descriptor in bad state", EBADFD => "EBADFD",
EREMCHG => "Remote address changed", EREMCHG => "EREMCHG",
ELIBACC => "Can not access a needed shared library", ELIBACC => "ELIBACC",
ELIBBAD => "Accessing a corrupted shared library", ELIBBAD => "ELIBBAD",
ELIBSCN => ".lib section in a.out corrupted", ELIBSCN => "ELIBSCN",
ELIBMAX => "Attempting to link in too many shared libraries", ELIBMAX => "ELIBMAX",
ELIBEXEC => "Cannot exec a shared library directly", ELIBEXEC => "ELIBEXEC",
EILSEQ => "Invalid or incomplete multibyte or wide character", EILSEQ => "EILSEQ",
ERESTART => "Interrupted system call should be restarted", ERESTART => "ERESTART",
ESTRPIPE => "Streams pipe error", ESTRPIPE => "ESTRPIPE",
EUSERS => "Too many users", EUSERS => "EUSERS",
ENOTSOCK => "Socket operation on non-socket", ENOTSOCK => "ENOTSOCK",
EDESTADDRREQ => "Destination address required", EDESTADDRREQ => "EDESTADDRREQ",
EMSGSIZE => "Message too long", EMSGSIZE => "EMSGSIZE",
EPROTOTYPE => "Protocol wrong type for socket", EPROTOTYPE => "EPROTOTYPE",
ENOPROTOOPT => "Protocol not available", ENOPROTOOPT => "ENOPROTOOPT",
EPROTONOSUPPORT => "Protocol not supported", EPROTONOSUPPORT => "EPROTONOSUPPORT",
ESOCKTNOSUPPORT => "Socket type not supported", ESOCKTNOSUPPORT => "ESOCKTNOSUPPORT",
ENOTSUP => "Operation not supported", ENOTSUP => "ENOTSUP",
EPFNOSUPPORT => "Protocol family not supported", EPFNOSUPPORT => "EPFNOSUPPORT",
EAFNOSUPPORT => "Address family not supported by protocol", EAFNOSUPPORT => "EAFNOSUPPORT",
EADDRINUSE => "Address already in use", EADDRINUSE => "EADDRINUSE",
EADDRNOTAVAIL => "Cannot assign requested address", EADDRNOTAVAIL => "EADDRNOTAVAIL",
ENETDOWN => "Network is down", ENETDOWN => "ENETDOWN",
ENETUNREACH => "Network is unreachable", ENETUNREACH => "ENETUNREACH",
ENETRESET => "Network dropped connection on reset", ENETRESET => "ENETRESET",
ECONNABORTED => "Software caused connection abort", ECONNABORTED => "ECONNABORTED",
ECONNRESET => "Connection reset by peer", ECONNRESET => "ECONNRESET",
ENOBUFS => "No buffer space available", ENOBUFS => "ENOBUFS",
EISCONN => "Transport endpoint is already connected", EISCONN => "EISCONN",
ENOTCONN => "Transport endpoint is not connected", ENOTCONN => "ENOTCONN",
ESHUTDOWN => "Cannot send after transport endpoint shutdown", ESHUTDOWN => "ESHUTDOWN",
ETOOMANYREFS => "Too many references: cannot splice", ETOOMANYREFS => "ETOOMANYREFS",
ETIMEDOUT => "Connection timed out", ETIMEDOUT => "ETIMEDOUT",
ECONNREFUSED => "Connection refused", ECONNREFUSED => "ECONNREFUSED",
EHOSTDOWN => "Host is down", EHOSTDOWN => "EHOSTDOWN",
EHOSTUNREACH => "No route to host", EHOSTUNREACH => "EHOSTUNREACH",
EALREADY => "Operation already in progress", EALREADY => "EALREADY",
EINPROGRESS => "Operation now in progress", EINPROGRESS => "EINPROGRESS",
ESTALE => "Stale file handle", ESTALE => "ESTALE",
EUCLEAN => "Structure needs cleaning", EUCLEAN => "EUCLEAN",
ENOTNAM => "Not a XENIX named type file", ENOTNAM => "ENOTNAM",
ENAVAIL => "No XENIX semaphores available", ENAVAIL => "ENAVAIL",
EISNAM => "Is a named type file", EISNAM => "EISNAM",
EREMOTEIO => "Remote I/O error", EREMOTEIO => "EREMOTEIO",
EDQUOT => "Disk quota exceeded", EDQUOT => "EDQUOT",
ENOMEDIUM => "No medium found", ENOMEDIUM => "ENOMEDIUM",
EMEDIUMTYPE => "Wrong medium type", EMEDIUMTYPE => "EMEDIUMTYPE",
ECANCELED => "Operation canceled", ECANCELED => "ECANCELED",
ENOKEY => "Required key not available", ENOKEY => "ENOKEY",
EKEYEXPIRED => "Key has expired", EKEYEXPIRED => "EKEYEXPIRED",
EKEYREVOKED => "Key has been revoked", EKEYREVOKED => "EKEYREVOKED",
EKEYREJECTED => "Key was rejected by service", EKEYREJECTED => "EKEYREJECTED",
EOWNERDEAD => "Owner died", EOWNERDEAD => "EOWNERDEAD",
ENOTRECOVERABLE => "State not recoverable", ENOTRECOVERABLE => "ENOTRECOVERABLE",
ERFKILL => "Operation not possible due to RF-kill", ERFKILL => "ERFKILL",
EHWPOISON => "Memory page has hardware error", EHWPOISON => "EHWPOISON",
EEOF => "Unexpected EOF", EEOF => "EEOF",
EINVALDAT => "Invalid data", EINVALDAT => "EINVALDAT",
EWRZERO => "Write zero", EWRZERO => "EWRZERO",
}; };
f.write_str(errno_name) f.write_str(errno_name)
} }

View File

@ -41,3 +41,8 @@ pub fn irq_register(irq: u8) -> Result<(), ()> {
pub fn wake_new(pid: u64) -> Result<(), ()> { pub fn wake_new(pid: u64) -> Result<(), ()> {
syscalls::wake_new(pid) syscalls::wake_new(pid)
} }
#[stable(feature = "mikros", since = "1.80.0")]
pub fn clear_exited(pid: u64) -> Result<(), ()> {
syscalls::clear_exited(pid)
}

View File

@ -12,7 +12,145 @@ pub fn errno() -> Errno {
} }
pub fn error_string(errno: Errno) -> String { pub fn error_string(errno: Errno) -> String {
errno.to_string() use Errno::*;
match errno {
EPERM => "Operation not permitted",
ENOENT => "No such file or directory",
ESRCH => "No such process",
EINTR => "Interrupted system call",
EIO => "Input/output error",
ENXIO => "No such device or address",
E2BIG => "Argument list too long",
ENOEXEC => "Exec format error",
EBADF => "Bad file descriptor",
ECHILD => "No child processes",
EAGAIN => "Resource temporarily unavailable",
EWOULDBLOCK => "Resource temporarily unavailable",
ENOMEM => "Cannot allocate memory",
EACCES => "Permission denied",
EFAULT => "Bad address",
ENOTBLK => "Block device required",
EBUSY => "Device or resource busy",
EEXIST => "File exists",
EXDEV => "Invalid cross-device link",
ENODEV => "No such device",
ENOTDIR => "Not a directory",
EISDIR => "Is a directory",
EINVAL => "Invalid argument",
ENFILE => "Too many open files in system",
EMFILE => "Too many open files",
ENOTTY => "Inappropriate ioctl for device",
ETXTBSY => "Text file busy",
EFBIG => "File too large",
ENOSPC => "No space left on device",
ESPIPE => "Illegal seek",
EROFS => "Read-only file system",
EMLINK => "Too many links",
EPIPE => "Broken pipe",
EDOM => "Numerical argument out of domain",
ERANGE => "Numerical result out of range",
EDEADLK => "Resource deadlock avoided",
ENAMETOOLONG => "File name too long",
ENOLCK => "No locks available",
ENOSYS => "Function not implemented",
ENOTEMPTY => "Directory not empty",
ELOOP => "Too many levels of symbolic links",
ENOMSG => "No message of desired type",
EIDRM => "Identifier removed",
ECHRNG => "Channel number out of range",
EL2NSYNC => "Level 2 not synchronized",
EL3HLT => "Level 3 halted",
EL3RST => "Level 3 reset",
ELNRNG => "Link number out of range",
EUNATCH => "Protocol driver not attached",
ENOCSI => "No CSI structure available",
EL2HLT => "Level 2 halted",
EBADE => "Invalid exchange",
EBADR => "Invalid request descriptor",
EXFULL => "Exchange full",
ENOANO => "No anode",
EBADRQC => "Invalid request code",
EBADSLT => "Invalid slot",
EBFONT => "Bad font file format",
ENOSTR => "Device not a stream",
ENODATA => "No data available",
ETIME => "Timer expired",
ENOSR => "Out of streams resources",
ENONET => "Machine is not on the network",
ENOPKG => "Package not installed",
EREMOTE => "Object is remote",
ENOLINK => "Link has been severed",
EADV => "Advertise error",
ESRMNT => "Srmount error",
ECOMM => "Communication error on send",
EPROTO => "Protocol error",
EMULTIHOP => "Multihop attempted",
EDOTDOT => "RFS specific error",
EBADMSG => "Bad message",
EOVERFLOW => "Value too large for defined data type",
ENOTUNIQ => "Name not unique on network",
EBADFD => "File descriptor in bad state",
EREMCHG => "Remote address changed",
ELIBACC => "Can not access a needed shared library",
ELIBBAD => "Accessing a corrupted shared library",
ELIBSCN => ".lib section in a.out corrupted",
ELIBMAX => "Attempting to link in too many shared libraries",
ELIBEXEC => "Cannot exec a shared library directly",
EILSEQ => "Invalid or incomplete multibyte or wide character",
ERESTART => "Interrupted system call should be restarted",
ESTRPIPE => "Streams pipe error",
EUSERS => "Too many users",
ENOTSOCK => "Socket operation on non-socket",
EDESTADDRREQ => "Destination address required",
EMSGSIZE => "Message too long",
EPROTOTYPE => "Protocol wrong type for socket",
ENOPROTOOPT => "Protocol not available",
EPROTONOSUPPORT => "Protocol not supported",
ESOCKTNOSUPPORT => "Socket type not supported",
ENOTSUP => "Operation not supported",
EPFNOSUPPORT => "Protocol family not supported",
EAFNOSUPPORT => "Address family not supported by protocol",
EADDRINUSE => "Address already in use",
EADDRNOTAVAIL => "Cannot assign requested address",
ENETDOWN => "Network is down",
ENETUNREACH => "Network is unreachable",
ENETRESET => "Network dropped connection on reset",
ECONNABORTED => "Software caused connection abort",
ECONNRESET => "Connection reset by peer",
ENOBUFS => "No buffer space available",
EISCONN => "Transport endpoint is already connected",
ENOTCONN => "Transport endpoint is not connected",
ESHUTDOWN => "Cannot send after transport endpoint shutdown",
ETOOMANYREFS => "Too many references: cannot splice",
ETIMEDOUT => "Connection timed out",
ECONNREFUSED => "Connection refused",
EHOSTDOWN => "Host is down",
EHOSTUNREACH => "No route to host",
EALREADY => "Operation already in progress",
EINPROGRESS => "Operation now in progress",
ESTALE => "Stale file handle",
EUCLEAN => "Structure needs cleaning",
ENOTNAM => "Not a XENIX named type file",
ENAVAIL => "No XENIX semaphores available",
EISNAM => "Is a named type file",
EREMOTEIO => "Remote I/O error",
EDQUOT => "Disk quota exceeded",
ENOMEDIUM => "No medium found",
EMEDIUMTYPE => "Wrong medium type",
ECANCELED => "Operation canceled",
ENOKEY => "Required key not available",
EKEYEXPIRED => "Key has expired",
EKEYREVOKED => "Key has been revoked",
EKEYREJECTED => "Key was rejected by service",
EOWNERDEAD => "Owner died",
ENOTRECOVERABLE => "State not recoverable",
ERFKILL => "Operation not possible due to RF-kill",
EHWPOISON => "Memory page has hardware error",
EEOF => "Unexpected EOF",
EINVALDAT => "Invalid data",
EWRZERO => "Write zero",
}
.to_string()
} }
pub fn getcwd() -> io::Result<PathBuf> { pub fn getcwd() -> io::Result<PathBuf> {

View File

@ -46,7 +46,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
//} //}
//Ok(buf.len()) //Ok(buf.len())
let Some(fd) = *STDOUT_FD.get().unwrap() else { let Some(fd) = *STDOUT_FD.get().unwrap() else {
return Ok(0); return Ok(buf.len());
}; };
let file = File { fs_pid: fd.0, fd: fd.1 }; let file = File { fs_pid: fd.0, fd: fd.1 };
let res = file.write(buf); let res = file.write(buf);
@ -74,7 +74,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
//} //}
//Ok(buf.len()) //Ok(buf.len())
let Some(fd) = *STDERR_FD.get().unwrap() else { let Some(fd) = *STDERR_FD.get().unwrap() else {
return Ok(0); return Ok(buf.len());
}; };
let file = File { fs_pid: fd.0, fd: fd.1 }; let file = File { fs_pid: fd.0, fd: fd.1 };
let res = file.write(buf); let res = file.write(buf);

View File

@ -194,3 +194,7 @@ pub fn irq_register(irq: u8) -> Result<(), ()> {
pub fn wake_new(pid: u64) -> Result<(), ()> { pub fn wake_new(pid: u64) -> Result<(), ()> {
if syscall1(24, pid) == 0 { Ok(()) } else { Err(()) } if syscall1(24, pid) == 0 { Ok(()) } else { Err(()) }
} }
pub fn clear_exited(pid: u64) -> Result<(), ()> {
if syscall1(25, pid) == 0 { Ok(()) } else { Err(()) }
}