Smp (#23)
* Fire up multiple processors * Use IPIs to wake up secondary processors * Much better exception information * Modifications to show more information on fault * WIP: Use real libstd * Add TLS (not complete) * Add random function, export getpid, cleanup * Do not spin APs until new context * Update rust * Update rust * Use rd/wrfsbase * Implement TLS * Implement compiler builtins and update rust * Update rust * Back to Redox libstd * Update rust
This commit is contained in:
parent
25dc44b348
commit
149b0297a4
54 changed files with 1121 additions and 380 deletions
|
@ -61,7 +61,13 @@ pub struct Stat {
|
|||
pub st_mode: u16,
|
||||
pub st_uid: u32,
|
||||
pub st_gid: u32,
|
||||
pub st_size: u64
|
||||
pub st_size: u64,
|
||||
pub st_mtime: u64,
|
||||
pub st_mtime_nsec: u32,
|
||||
pub st_atime: u64,
|
||||
pub st_atime_nsec: u32,
|
||||
pub st_ctime: u64,
|
||||
pub st_ctime_nsec: u32,
|
||||
}
|
||||
|
||||
impl Deref for Stat {
|
||||
|
|
|
@ -2,13 +2,13 @@ use core::{fmt, result};
|
|||
|
||||
#[derive(Eq, PartialEq)]
|
||||
pub struct Error {
|
||||
pub errno: isize,
|
||||
pub errno: i32,
|
||||
}
|
||||
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
impl Error {
|
||||
pub fn new(errno: isize) -> Error {
|
||||
pub fn new(errno: i32) -> Error {
|
||||
Error { errno: errno }
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@ impl Error {
|
|||
}
|
||||
|
||||
pub fn demux(value: usize) -> Result<usize> {
|
||||
let errno = -(value as isize);
|
||||
if errno >= 1 && errno < STR_ERROR.len() as isize {
|
||||
let errno = -(value as i32);
|
||||
if errno >= 1 && errno < STR_ERROR.len() as i32 {
|
||||
Err(Error::new(errno))
|
||||
} else {
|
||||
Ok(value)
|
||||
|
@ -49,137 +49,137 @@ impl fmt::Display for Error {
|
|||
}
|
||||
}
|
||||
|
||||
pub const EPERM: isize = 1; /* Operation not permitted */
|
||||
pub const ENOENT: isize = 2; /* No such file or directory */
|
||||
pub const ESRCH: isize = 3; /* No such process */
|
||||
pub const EINTR: isize = 4; /* Interrupted system call */
|
||||
pub const EIO: isize = 5; /* I/O error */
|
||||
pub const ENXIO: isize = 6; /* No such device or address */
|
||||
pub const E2BIG: isize = 7; /* Argument list too long */
|
||||
pub const ENOEXEC: isize = 8; /* Exec format error */
|
||||
pub const EBADF: isize = 9; /* Bad file number */
|
||||
pub const ECHILD: isize = 10; /* No child processes */
|
||||
pub const EAGAIN: isize = 11; /* Try again */
|
||||
pub const ENOMEM: isize = 12; /* Out of memory */
|
||||
pub const EACCES: isize = 13; /* Permission denied */
|
||||
pub const EFAULT: isize = 14; /* Bad address */
|
||||
pub const ENOTBLK: isize = 15; /* Block device required */
|
||||
pub const EBUSY: isize = 16; /* Device or resource busy */
|
||||
pub const EEXIST: isize = 17; /* File exists */
|
||||
pub const EXDEV: isize = 18; /* Cross-device link */
|
||||
pub const ENODEV: isize = 19; /* No such device */
|
||||
pub const ENOTDIR: isize = 20; /* Not a directory */
|
||||
pub const EISDIR: isize = 21; /* Is a directory */
|
||||
pub const EINVAL: isize = 22; /* Invalid argument */
|
||||
pub const ENFILE: isize = 23; /* File table overflow */
|
||||
pub const EMFILE: isize = 24; /* Too many open files */
|
||||
pub const ENOTTY: isize = 25; /* Not a typewriter */
|
||||
pub const ETXTBSY: isize = 26; /* Text file busy */
|
||||
pub const EFBIG: isize = 27; /* File too large */
|
||||
pub const ENOSPC: isize = 28; /* No space left on device */
|
||||
pub const ESPIPE: isize = 29; /* Illegal seek */
|
||||
pub const EROFS: isize = 30; /* Read-only file system */
|
||||
pub const EMLINK: isize = 31; /* Too many links */
|
||||
pub const EPIPE: isize = 32; /* Broken pipe */
|
||||
pub const EDOM: isize = 33; /* Math argument out of domain of func */
|
||||
pub const ERANGE: isize = 34; /* Math result not representable */
|
||||
pub const EDEADLK: isize = 35; /* Resource deadlock would occur */
|
||||
pub const ENAMETOOLONG: isize = 36; /* File name too long */
|
||||
pub const ENOLCK: isize = 37; /* No record locks available */
|
||||
pub const ENOSYS: isize = 38; /* Function not implemented */
|
||||
pub const ENOTEMPTY: isize = 39; /* Directory not empty */
|
||||
pub const ELOOP: isize = 40; /* Too many symbolic links encountered */
|
||||
pub const EWOULDBLOCK: isize = 41; /* Operation would block */
|
||||
pub const ENOMSG: isize = 42; /* No message of desired type */
|
||||
pub const EIDRM: isize = 43; /* Identifier removed */
|
||||
pub const ECHRNG: isize = 44; /* Channel number out of range */
|
||||
pub const EL2NSYNC: isize = 45; /* Level 2 not synchronized */
|
||||
pub const EL3HLT: isize = 46; /* Level 3 halted */
|
||||
pub const EL3RST: isize = 47; /* Level 3 reset */
|
||||
pub const ELNRNG: isize = 48; /* Link number out of range */
|
||||
pub const EUNATCH: isize = 49; /* Protocol driver not attached */
|
||||
pub const ENOCSI: isize = 50; /* No CSI structure available */
|
||||
pub const EL2HLT: isize = 51; /* Level 2 halted */
|
||||
pub const EBADE: isize = 52; /* Invalid exchange */
|
||||
pub const EBADR: isize = 53; /* Invalid request descriptor */
|
||||
pub const EXFULL: isize = 54; /* Exchange full */
|
||||
pub const ENOANO: isize = 55; /* No anode */
|
||||
pub const EBADRQC: isize = 56; /* Invalid request code */
|
||||
pub const EBADSLT: isize = 57; /* Invalid slot */
|
||||
pub const EDEADLOCK: isize = 58; /* Resource deadlock would occur */
|
||||
pub const EBFONT: isize = 59; /* Bad font file format */
|
||||
pub const ENOSTR: isize = 60; /* Device not a stream */
|
||||
pub const ENODATA: isize = 61; /* No data available */
|
||||
pub const ETIME: isize = 62; /* Timer expired */
|
||||
pub const ENOSR: isize = 63; /* Out of streams resources */
|
||||
pub const ENONET: isize = 64; /* Machine is not on the network */
|
||||
pub const ENOPKG: isize = 65; /* Package not installed */
|
||||
pub const EREMOTE: isize = 66; /* Object is remote */
|
||||
pub const ENOLINK: isize = 67; /* Link has been severed */
|
||||
pub const EADV: isize = 68; /* Advertise error */
|
||||
pub const ESRMNT: isize = 69; /* Srmount error */
|
||||
pub const ECOMM: isize = 70; /* Communication error on send */
|
||||
pub const EPROTO: isize = 71; /* Protocol error */
|
||||
pub const EMULTIHOP: isize = 72; /* Multihop attempted */
|
||||
pub const EDOTDOT: isize = 73; /* RFS specific error */
|
||||
pub const EBADMSG: isize = 74; /* Not a data message */
|
||||
pub const EOVERFLOW: isize = 75; /* Value too large for defined data type */
|
||||
pub const ENOTUNIQ: isize = 76; /* Name not unique on network */
|
||||
pub const EBADFD: isize = 77; /* File descriptor in bad state */
|
||||
pub const EREMCHG: isize = 78; /* Remote address changed */
|
||||
pub const ELIBACC: isize = 79; /* Can not access a needed shared library */
|
||||
pub const ELIBBAD: isize = 80; /* Accessing a corrupted shared library */
|
||||
pub const ELIBSCN: isize = 81; /* .lib section in a.out corrupted */
|
||||
pub const ELIBMAX: isize = 82; /* Attempting to link in too many shared libraries */
|
||||
pub const ELIBEXEC: isize = 83; /* Cannot exec a shared library directly */
|
||||
pub const EILSEQ: isize = 84; /* Illegal byte sequence */
|
||||
pub const ERESTART: isize = 85; /* Interrupted system call should be restarted */
|
||||
pub const ESTRPIPE: isize = 86; /* Streams pipe error */
|
||||
pub const EUSERS: isize = 87; /* Too many users */
|
||||
pub const ENOTSOCK: isize = 88; /* Socket operation on non-socket */
|
||||
pub const EDESTADDRREQ: isize = 89; /* Destination address required */
|
||||
pub const EMSGSIZE: isize = 90; /* Message too long */
|
||||
pub const EPROTOTYPE: isize = 91; /* Protocol wrong type for socket */
|
||||
pub const ENOPROTOOPT: isize = 92; /* Protocol not available */
|
||||
pub const EPROTONOSUPPORT: isize = 93; /* Protocol not supported */
|
||||
pub const ESOCKTNOSUPPORT: isize = 94; /* Socket type not supported */
|
||||
pub const EOPNOTSUPP: isize = 95; /* Operation not supported on transport endpoint */
|
||||
pub const EPFNOSUPPORT: isize = 96; /* Protocol family not supported */
|
||||
pub const EAFNOSUPPORT: isize = 97; /* Address family not supported by protocol */
|
||||
pub const EADDRINUSE: isize = 98; /* Address already in use */
|
||||
pub const EADDRNOTAVAIL: isize = 99; /* Cannot assign requested address */
|
||||
pub const ENETDOWN: isize = 100; /* Network is down */
|
||||
pub const ENETUNREACH: isize = 101; /* Network is unreachable */
|
||||
pub const ENETRESET: isize = 102; /* Network dropped connection because of reset */
|
||||
pub const ECONNABORTED: isize = 103; /* Software caused connection abort */
|
||||
pub const ECONNRESET: isize = 104; /* Connection reset by peer */
|
||||
pub const ENOBUFS: isize = 105; /* No buffer space available */
|
||||
pub const EISCONN: isize = 106; /* Transport endpoint is already connected */
|
||||
pub const ENOTCONN: isize = 107; /* Transport endpoint is not connected */
|
||||
pub const ESHUTDOWN: isize = 108; /* Cannot send after transport endpoint shutdown */
|
||||
pub const ETOOMANYREFS: isize = 109; /* Too many references: cannot splice */
|
||||
pub const ETIMEDOUT: isize = 110; /* Connection timed out */
|
||||
pub const ECONNREFUSED: isize = 111; /* Connection refused */
|
||||
pub const EHOSTDOWN: isize = 112; /* Host is down */
|
||||
pub const EHOSTUNREACH: isize = 113; /* No route to host */
|
||||
pub const EALREADY: isize = 114; /* Operation already in progress */
|
||||
pub const EINPROGRESS: isize = 115; /* Operation now in progress */
|
||||
pub const ESTALE: isize = 116; /* Stale NFS file handle */
|
||||
pub const EUCLEAN: isize = 117; /* Structure needs cleaning */
|
||||
pub const ENOTNAM: isize = 118; /* Not a XENIX named type file */
|
||||
pub const ENAVAIL: isize = 119; /* No XENIX semaphores available */
|
||||
pub const EISNAM: isize = 120; /* Is a named type file */
|
||||
pub const EREMOTEIO: isize = 121; /* Remote I/O error */
|
||||
pub const EDQUOT: isize = 122; /* Quota exceeded */
|
||||
pub const ENOMEDIUM: isize = 123; /* No medium found */
|
||||
pub const EMEDIUMTYPE: isize = 124; /* Wrong medium type */
|
||||
pub const ECANCELED: isize = 125; /* Operation Canceled */
|
||||
pub const ENOKEY: isize = 126; /* Required key not available */
|
||||
pub const EKEYEXPIRED: isize = 127; /* Key has expired */
|
||||
pub const EKEYREVOKED: isize = 128; /* Key has been revoked */
|
||||
pub const EKEYREJECTED: isize = 129; /* Key was rejected by service */
|
||||
pub const EOWNERDEAD: isize = 130; /* Owner died */
|
||||
pub const ENOTRECOVERABLE: isize = 131; /* State not recoverable */
|
||||
pub const EPERM: i32 = 1; /* Operation not permitted */
|
||||
pub const ENOENT: i32 = 2; /* No such file or directory */
|
||||
pub const ESRCH: i32 = 3; /* No such process */
|
||||
pub const EINTR: i32 = 4; /* Interrupted system call */
|
||||
pub const EIO: i32 = 5; /* I/O error */
|
||||
pub const ENXIO: i32 = 6; /* No such device or address */
|
||||
pub const E2BIG: i32 = 7; /* Argument list too long */
|
||||
pub const ENOEXEC: i32 = 8; /* Exec format error */
|
||||
pub const EBADF: i32 = 9; /* Bad file number */
|
||||
pub const ECHILD: i32 = 10; /* No child processes */
|
||||
pub const EAGAIN: i32 = 11; /* Try again */
|
||||
pub const ENOMEM: i32 = 12; /* Out of memory */
|
||||
pub const EACCES: i32 = 13; /* Permission denied */
|
||||
pub const EFAULT: i32 = 14; /* Bad address */
|
||||
pub const ENOTBLK: i32 = 15; /* Block device required */
|
||||
pub const EBUSY: i32 = 16; /* Device or resource busy */
|
||||
pub const EEXIST: i32 = 17; /* File exists */
|
||||
pub const EXDEV: i32 = 18; /* Cross-device link */
|
||||
pub const ENODEV: i32 = 19; /* No such device */
|
||||
pub const ENOTDIR: i32 = 20; /* Not a directory */
|
||||
pub const EISDIR: i32 = 21; /* Is a directory */
|
||||
pub const EINVAL: i32 = 22; /* Invalid argument */
|
||||
pub const ENFILE: i32 = 23; /* File table overflow */
|
||||
pub const EMFILE: i32 = 24; /* Too many open files */
|
||||
pub const ENOTTY: i32 = 25; /* Not a typewriter */
|
||||
pub const ETXTBSY: i32 = 26; /* Text file busy */
|
||||
pub const EFBIG: i32 = 27; /* File too large */
|
||||
pub const ENOSPC: i32 = 28; /* No space left on device */
|
||||
pub const ESPIPE: i32 = 29; /* Illegal seek */
|
||||
pub const EROFS: i32 = 30; /* Read-only file system */
|
||||
pub const EMLINK: i32 = 31; /* Too many links */
|
||||
pub const EPIPE: i32 = 32; /* Broken pipe */
|
||||
pub const EDOM: i32 = 33; /* Math argument out of domain of func */
|
||||
pub const ERANGE: i32 = 34; /* Math result not representable */
|
||||
pub const EDEADLK: i32 = 35; /* Resource deadlock would occur */
|
||||
pub const ENAMETOOLONG: i32 = 36; /* File name too long */
|
||||
pub const ENOLCK: i32 = 37; /* No record locks available */
|
||||
pub const ENOSYS: i32 = 38; /* Function not implemented */
|
||||
pub const ENOTEMPTY: i32 = 39; /* Directory not empty */
|
||||
pub const ELOOP: i32 = 40; /* Too many symbolic links encountered */
|
||||
pub const EWOULDBLOCK: i32 = 41; /* Operation would block */
|
||||
pub const ENOMSG: i32 = 42; /* No message of desired type */
|
||||
pub const EIDRM: i32 = 43; /* Identifier removed */
|
||||
pub const ECHRNG: i32 = 44; /* Channel number out of range */
|
||||
pub const EL2NSYNC: i32 = 45; /* Level 2 not synchronized */
|
||||
pub const EL3HLT: i32 = 46; /* Level 3 halted */
|
||||
pub const EL3RST: i32 = 47; /* Level 3 reset */
|
||||
pub const ELNRNG: i32 = 48; /* Link number out of range */
|
||||
pub const EUNATCH: i32 = 49; /* Protocol driver not attached */
|
||||
pub const ENOCSI: i32 = 50; /* No CSI structure available */
|
||||
pub const EL2HLT: i32 = 51; /* Level 2 halted */
|
||||
pub const EBADE: i32 = 52; /* Invalid exchange */
|
||||
pub const EBADR: i32 = 53; /* Invalid request descriptor */
|
||||
pub const EXFULL: i32 = 54; /* Exchange full */
|
||||
pub const ENOANO: i32 = 55; /* No anode */
|
||||
pub const EBADRQC: i32 = 56; /* Invalid request code */
|
||||
pub const EBADSLT: i32 = 57; /* Invalid slot */
|
||||
pub const EDEADLOCK: i32 = 58; /* Resource deadlock would occur */
|
||||
pub const EBFONT: i32 = 59; /* Bad font file format */
|
||||
pub const ENOSTR: i32 = 60; /* Device not a stream */
|
||||
pub const ENODATA: i32 = 61; /* No data available */
|
||||
pub const ETIME: i32 = 62; /* Timer expired */
|
||||
pub const ENOSR: i32 = 63; /* Out of streams resources */
|
||||
pub const ENONET: i32 = 64; /* Machine is not on the network */
|
||||
pub const ENOPKG: i32 = 65; /* Package not installed */
|
||||
pub const EREMOTE: i32 = 66; /* Object is remote */
|
||||
pub const ENOLINK: i32 = 67; /* Link has been severed */
|
||||
pub const EADV: i32 = 68; /* Advertise error */
|
||||
pub const ESRMNT: i32 = 69; /* Srmount error */
|
||||
pub const ECOMM: i32 = 70; /* Communication error on send */
|
||||
pub const EPROTO: i32 = 71; /* Protocol error */
|
||||
pub const EMULTIHOP: i32 = 72; /* Multihop attempted */
|
||||
pub const EDOTDOT: i32 = 73; /* RFS specific error */
|
||||
pub const EBADMSG: i32 = 74; /* Not a data message */
|
||||
pub const EOVERFLOW: i32 = 75; /* Value too large for defined data type */
|
||||
pub const ENOTUNIQ: i32 = 76; /* Name not unique on network */
|
||||
pub const EBADFD: i32 = 77; /* File descriptor in bad state */
|
||||
pub const EREMCHG: i32 = 78; /* Remote address changed */
|
||||
pub const ELIBACC: i32 = 79; /* Can not access a needed shared library */
|
||||
pub const ELIBBAD: i32 = 80; /* Accessing a corrupted shared library */
|
||||
pub const ELIBSCN: i32 = 81; /* .lib section in a.out corrupted */
|
||||
pub const ELIBMAX: i32 = 82; /* Attempting to link in too many shared libraries */
|
||||
pub const ELIBEXEC: i32 = 83; /* Cannot exec a shared library directly */
|
||||
pub const EILSEQ: i32 = 84; /* Illegal byte sequence */
|
||||
pub const ERESTART: i32 = 85; /* Interrupted system call should be restarted */
|
||||
pub const ESTRPIPE: i32 = 86; /* Streams pipe error */
|
||||
pub const EUSERS: i32 = 87; /* Too many users */
|
||||
pub const ENOTSOCK: i32 = 88; /* Socket operation on non-socket */
|
||||
pub const EDESTADDRREQ: i32 = 89; /* Destination address required */
|
||||
pub const EMSGSIZE: i32 = 90; /* Message too long */
|
||||
pub const EPROTOTYPE: i32 = 91; /* Protocol wrong type for socket */
|
||||
pub const ENOPROTOOPT: i32 = 92; /* Protocol not available */
|
||||
pub const EPROTONOSUPPORT: i32 = 93; /* Protocol not supported */
|
||||
pub const ESOCKTNOSUPPORT: i32 = 94; /* Socket type not supported */
|
||||
pub const EOPNOTSUPP: i32 = 95; /* Operation not supported on transport endpoint */
|
||||
pub const EPFNOSUPPORT: i32 = 96; /* Protocol family not supported */
|
||||
pub const EAFNOSUPPORT: i32 = 97; /* Address family not supported by protocol */
|
||||
pub const EADDRINUSE: i32 = 98; /* Address already in use */
|
||||
pub const EADDRNOTAVAIL: i32 = 99; /* Cannot assign requested address */
|
||||
pub const ENETDOWN: i32 = 100; /* Network is down */
|
||||
pub const ENETUNREACH: i32 = 101; /* Network is unreachable */
|
||||
pub const ENETRESET: i32 = 102; /* Network dropped connection because of reset */
|
||||
pub const ECONNABORTED: i32 = 103; /* Software caused connection abort */
|
||||
pub const ECONNRESET: i32 = 104; /* Connection reset by peer */
|
||||
pub const ENOBUFS: i32 = 105; /* No buffer space available */
|
||||
pub const EISCONN: i32 = 106; /* Transport endpoint is already connected */
|
||||
pub const ENOTCONN: i32 = 107; /* Transport endpoint is not connected */
|
||||
pub const ESHUTDOWN: i32 = 108; /* Cannot send after transport endpoint shutdown */
|
||||
pub const ETOOMANYREFS: i32 = 109; /* Too many references: cannot splice */
|
||||
pub const ETIMEDOUT: i32 = 110; /* Connection timed out */
|
||||
pub const ECONNREFUSED: i32 = 111; /* Connection refused */
|
||||
pub const EHOSTDOWN: i32 = 112; /* Host is down */
|
||||
pub const EHOSTUNREACH: i32 = 113; /* No route to host */
|
||||
pub const EALREADY: i32 = 114; /* Operation already in progress */
|
||||
pub const EINPROGRESS: i32 = 115; /* Operation now in progress */
|
||||
pub const ESTALE: i32 = 116; /* Stale NFS file handle */
|
||||
pub const EUCLEAN: i32 = 117; /* Structure needs cleaning */
|
||||
pub const ENOTNAM: i32 = 118; /* Not a XENIX named type file */
|
||||
pub const ENAVAIL: i32 = 119; /* No XENIX semaphores available */
|
||||
pub const EISNAM: i32 = 120; /* Is a named type file */
|
||||
pub const EREMOTEIO: i32 = 121; /* Remote I/O error */
|
||||
pub const EDQUOT: i32 = 122; /* Quota exceeded */
|
||||
pub const ENOMEDIUM: i32 = 123; /* No medium found */
|
||||
pub const EMEDIUMTYPE: i32 = 124; /* Wrong medium type */
|
||||
pub const ECANCELED: i32 = 125; /* Operation Canceled */
|
||||
pub const ENOKEY: i32 = 126; /* Required key not available */
|
||||
pub const EKEYEXPIRED: i32 = 127; /* Key has expired */
|
||||
pub const EKEYREVOKED: i32 = 128; /* Key has been revoked */
|
||||
pub const EKEYREJECTED: i32 = 129; /* Key was rejected by service */
|
||||
pub const EOWNERDEAD: i32 = 130; /* Owner died */
|
||||
pub const ENOTRECOVERABLE: i32 = 131; /* State not recoverable */
|
||||
|
||||
pub static STR_ERROR: [&'static str; 132] = ["Success",
|
||||
"Operation not permitted",
|
||||
|
|
|
@ -47,6 +47,7 @@ pub const O_CLOEXEC: usize = 0x0100_0000;
|
|||
pub const O_CREAT: usize = 0x0200_0000;
|
||||
pub const O_TRUNC: usize = 0x0400_0000;
|
||||
pub const O_EXCL: usize = 0x0800_0000;
|
||||
pub const O_ACCMODE: usize = O_RDONLY | O_WRONLY | O_RDWR;
|
||||
|
||||
pub const SEEK_SET: usize = 0;
|
||||
pub const SEEK_CUR: usize = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue