wa-lang.org/wazero@v1.0.2/internal/wasi_snapshot_preview1/errno.go (about) 1 // Package wasi_snapshot_preview1 is an internal helper to remove package 2 // cycles re-using errno 3 package wasi_snapshot_preview1 4 5 import ( 6 "fmt" 7 ) 8 9 // ErrnoName returns the POSIX error code name, except ErrnoSuccess, which is not an error. e.g. Errno2big -> "E2BIG" 10 func ErrnoName(errno uint32) string { 11 if int(errno) < len(errnoToString) { 12 return errnoToString[errno] 13 } 14 return fmt.Sprintf("errno(%d)", errno) 15 } 16 17 var errnoToString = [...]string{ 18 "ESUCCESS", 19 "E2BIG", 20 "EACCES", 21 "EADDRINUSE", 22 "EADDRNOTAVAIL", 23 "EAFNOSUPPORT", 24 "EAGAIN", 25 "EALREADY", 26 "EBADF", 27 "EBADMSG", 28 "EBUSY", 29 "ECANCELED", 30 "ECHILD", 31 "ECONNABORTED", 32 "ECONNREFUSED", 33 "ECONNRESET", 34 "EDEADLK", 35 "EDESTADDRREQ", 36 "EDOM", 37 "EDQUOT", 38 "EEXIST", 39 "EFAULT", 40 "EFBIG", 41 "EHOSTUNREACH", 42 "EIDRM", 43 "EILSEQ", 44 "EINPROGRESS", 45 "EINTR", 46 "EINVAL", 47 "EIO", 48 "EISCONN", 49 "EISDIR", 50 "ELOOP", 51 "EMFILE", 52 "EMLINK", 53 "EMSGSIZE", 54 "EMULTIHOP", 55 "ENAMETOOLONG", 56 "ENETDOWN", 57 "ENETRESET", 58 "ENETUNREACH", 59 "ENFILE", 60 "ENOBUFS", 61 "ENODEV", 62 "ENOENT", 63 "ENOEXEC", 64 "ENOLCK", 65 "ENOLINK", 66 "ENOMEM", 67 "ENOMSG", 68 "ENOPROTOOPT", 69 "ENOSPC", 70 "ENOSYS", 71 "ENOTCONN", 72 "ENOTDIR", 73 "ENOTEMPTY", 74 "ENOTRECOVERABLE", 75 "ENOTSOCK", 76 "ENOTSUP", 77 "ENOTTY", 78 "ENXIO", 79 "EOVERFLOW", 80 "EOWNERDEAD", 81 "EPERM", 82 "EPIPE", 83 "EPROTO", 84 "EPROTONOSUPPORT", 85 "EPROTOTYPE", 86 "ERANGE", 87 "EROFS", 88 "ESPIPE", 89 "ESRCH", 90 "ESTALE", 91 "ETIMEDOUT", 92 "ETXTBSY", 93 "EXDEV", 94 "ENOTCAPABLE", 95 }