From a94372231ca3c4daab3cf2bc54d2de135ecdd5e8 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Thu, 26 Sep 2019 18:07:39 +0200 Subject: [PATCH] Errno changes for MIPS --- lib/std/os/bits/linux.zig | 6 +- .../linux/{errno.zig => errno-generic.zig} | 0 lib/std/os/bits/linux/errno-mips.zig | 134 ++++++++++++++++++ lib/std/os/zen.zig | 2 +- 4 files changed, 140 insertions(+), 2 deletions(-) rename lib/std/os/bits/linux/{errno.zig => errno-generic.zig} (100%) create mode 100644 lib/std/os/bits/linux/errno-mips.zig diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig index 7cf6658a48..2cc55e1469 100644 --- a/lib/std/os/bits/linux.zig +++ b/lib/std/os/bits/linux.zig @@ -3,7 +3,11 @@ const std = @import("../../std.zig"); const maxInt = std.math.maxInt; usingnamespace @import("../bits.zig"); -pub usingnamespace @import("linux/errno.zig"); +pub usingnamespace switch (builtin.arch) { + .mips, .mipsel => @import("linux/errno-mips.zig"), + else => @import("linux/errno-generic.zig"), +}; + pub usingnamespace switch (builtin.arch) { .x86_64 => @import("linux/x86_64.zig"), .aarch64 => @import("linux/arm64.zig"), diff --git a/lib/std/os/bits/linux/errno.zig b/lib/std/os/bits/linux/errno-generic.zig similarity index 100% rename from lib/std/os/bits/linux/errno.zig rename to lib/std/os/bits/linux/errno-generic.zig diff --git a/lib/std/os/bits/linux/errno-mips.zig b/lib/std/os/bits/linux/errno-mips.zig new file mode 100644 index 0000000000..81cbde4af4 --- /dev/null +++ b/lib/std/os/bits/linux/errno-mips.zig @@ -0,0 +1,134 @@ +pub const EPERM = 1; +pub const ENOENT = 2; +pub const ESRCH = 3; +pub const EINTR = 4; +pub const EIO = 5; +pub const ENXIO = 6; +pub const E2BIG = 7; +pub const ENOEXEC = 8; +pub const EBADF = 9; +pub const ECHILD = 10; +pub const EAGAIN = 11; +pub const ENOMEM = 12; +pub const EACCES = 13; +pub const EFAULT = 14; +pub const ENOTBLK = 15; +pub const EBUSY = 16; +pub const EEXIST = 17; +pub const EXDEV = 18; +pub const ENODEV = 19; +pub const ENOTDIR = 20; +pub const EISDIR = 21; +pub const EINVAL = 22; +pub const ENFILE = 23; +pub const EMFILE = 24; +pub const ENOTTY = 25; +pub const ETXTBSY = 26; +pub const EFBIG = 27; +pub const ENOSPC = 28; +pub const ESPIPE = 29; +pub const EROFS = 30; +pub const EMLINK = 31; +pub const EPIPE = 32; +pub const EDOM = 33; +pub const ERANGE = 34; +pub const ENOMSG = 35; +pub const EIDRM = 36; +pub const ECHRNG = 37; +pub const EL2NSYNC = 38; +pub const EL3HLT = 39; +pub const EL3RST = 40; +pub const ELNRNG = 41; +pub const EUNATCH = 42; +pub const ENOCSI = 43; +pub const EL2HLT = 44; +pub const EDEADLK = 45; +pub const ENOLCK = 46; +pub const EBADE = 50; +pub const EBADR = 51; +pub const EXFULL = 52; +pub const ENOANO = 53; +pub const EBADRQC = 54; +pub const EBADSLT = 55; +pub const EDEADLOCK = 56; +pub const EBFONT = 59; +pub const ENOSTR = 60; +pub const ENODATA = 61; +pub const ETIME = 62; +pub const ENOSR = 63; +pub const ENONET = 64; +pub const ENOPKG = 65; +pub const EREMOTE = 66; +pub const ENOLINK = 67; +pub const EADV = 68; +pub const ESRMNT = 69; +pub const ECOMM = 70; +pub const EPROTO = 71; +pub const EDOTDOT = 73; +pub const EMULTIHOP = 74; +pub const EBADMSG = 77; +pub const ENAMETOOLONG = 78; +pub const EOVERFLOW = 79; +pub const ENOTUNIQ = 80; +pub const EBADFD = 81; +pub const EREMCHG = 82; +pub const ELIBACC = 83; +pub const ELIBBAD = 84; +pub const ELIBSCN = 85; +pub const ELIBMAX = 86; +pub const ELIBEXEC = 87; +pub const EILSEQ = 88; +pub const ENOSYS = 89; +pub const ELOOP = 90; +pub const ERESTART = 91; +pub const ESTRPIPE = 92; +pub const ENOTEMPTY = 93; +pub const EUSERS = 94; +pub const ENOTSOCK = 95; +pub const EDESTADDRREQ = 96; +pub const EMSGSIZE = 97; +pub const EPROTOTYPE = 98; +pub const ENOPROTOOPT = 99; +pub const EPROTONOSUPPORT = 120; +pub const ESOCKTNOSUPPORT = 121; +pub const EOPNOTSUPP = 122; +pub const ENOTSUP = EOPNOTSUPP; +pub const EPFNOSUPPORT = 123; +pub const EAFNOSUPPORT = 124; +pub const EADDRINUSE = 125; +pub const EADDRNOTAVAIL = 126; +pub const ENETDOWN = 127; +pub const ENETUNREACH = 128; +pub const ENETRESET = 129; +pub const ECONNABORTED = 130; +pub const ECONNRESET = 131; +pub const ENOBUFS = 132; +pub const EISCONN = 133; +pub const ENOTCONN = 134; +pub const EUCLEAN = 135; +pub const ENOTNAM = 137; +pub const ENAVAIL = 138; +pub const EISNAM = 139; +pub const EREMOTEIO = 140; +pub const ESHUTDOWN = 143; +pub const ETOOMANYREFS = 144; +pub const ETIMEDOUT = 145; +pub const ECONNREFUSED = 146; +pub const EHOSTDOWN = 147; +pub const EHOSTUNREACH = 148; +pub const EWOULDBLOCK = EAGAIN; +pub const EALREADY = 149; +pub const EINPROGRESS = 150; +pub const ESTALE = 151; +pub const ECANCELED = 158; +pub const ENOMEDIUM = 159; +pub const EMEDIUMTYPE = 160; +pub const ENOKEY = 161; +pub const EKEYEXPIRED = 162; +pub const EKEYREVOKED = 163; +pub const EKEYREJECTED = 164; +pub const EOWNERDEAD = 165; +pub const ENOTRECOVERABLE = 166; +pub const ERFKILL = 167; +pub const EHWPOISON = 168; +pub const EDQUOT = 1133; diff --git a/lib/std/os/zen.zig b/lib/std/os/zen.zig index 727f55fa6d..9d111d98ae 100644 --- a/lib/std/os/zen.zig +++ b/lib/std/os/zen.zig @@ -80,7 +80,7 @@ pub const STDOUT_FILENO = 1; pub const STDERR_FILENO = 2; // FIXME: let's borrow Linux's error numbers for now. -usingnamespace @import("bits/linux/errno.zig"); +usingnamespace @import("bits/linux/errno-generic.zig"); // Get the errno from a syscall return value, or 0 for no error. pub fn getErrno(r: usize) usize { const signed_r = @bitCast(isize, r);