diff options
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/_util/os.ts | 2 | ||||
-rw-r--r-- | ext/node/polyfills/internal_binding/uv.ts | 93 | ||||
-rw-r--r-- | ext/node/polyfills/os.ts | 3 |
3 files changed, 97 insertions, 1 deletions
diff --git a/ext/node/polyfills/_util/os.ts b/ext/node/polyfills/_util/os.ts index a3cb396bd..ff5e2efd5 100644 --- a/ext/node/polyfills/_util/os.ts +++ b/ext/node/polyfills/_util/os.ts @@ -2,7 +2,7 @@ const { ops } = globalThis.__bootstrap.core; -export type OSType = "windows" | "linux" | "darwin" | "freebsd"; +export type OSType = "windows" | "linux" | "darwin" | "freebsd" | "openbsd"; export const osType: OSType = ops.op_node_build_os(); diff --git a/ext/node/polyfills/internal_binding/uv.ts b/ext/node/polyfills/internal_binding/uv.ts index e7f6b890b..bc295fa65 100644 --- a/ext/node/polyfills/internal_binding/uv.ts +++ b/ext/node/polyfills/internal_binding/uv.ts @@ -395,6 +395,95 @@ const errorToCodeFreebsd: CodeMapData = codeToErrorFreebsd.map(( [status, [code]], ) => [code, status]); +const codeToErrorOpenBSD: ErrorMapData = [ + [-7, ["E2BIG", "argument list too long"]], + [-13, ["EACCES", "permission denied"]], + [-48, ["EADDRINUSE", "address already in use"]], + [-49, ["EADDRNOTAVAIL", "address not available"]], + [-47, ["EAFNOSUPPORT", "address family not supported"]], + [-35, ["EAGAIN", "resource temporarily unavailable"]], + [-3000, ["EAI_ADDRFAMILY", "address family not supported"]], + [-3001, ["EAI_AGAIN", "temporary failure"]], + [-3002, ["EAI_BADFLAGS", "bad ai_flags value"]], + [-3013, ["EAI_BADHINTS", "invalid value for hints"]], + [-3003, ["EAI_CANCELED", "request canceled"]], + [-3004, ["EAI_FAIL", "permanent failure"]], + [-3005, ["EAI_FAMILY", "ai_family not supported"]], + [-3006, ["EAI_MEMORY", "out of memory"]], + [-3007, ["EAI_NODATA", "no address"]], + [-3008, ["EAI_NONAME", "unknown node or service"]], + [-3009, ["EAI_OVERFLOW", "argument buffer overflow"]], + [-3014, ["EAI_PROTOCOL", "resolved protocol is unknown"]], + [-3010, ["EAI_SERVICE", "service not available for socket type"]], + [-3011, ["EAI_SOCKTYPE", "socket type not supported"]], + [-37, ["EALREADY", "connection already in progress"]], + [-9, ["EBADF", "bad file descriptor"]], + [-16, ["EBUSY", "resource busy or locked"]], + [-88, ["ECANCELED", "operation canceled"]], + [-4080, ["ECHARSET", "invalid Unicode character"]], + [-53, ["ECONNABORTED", "software caused connection abort"]], + [-61, ["ECONNREFUSED", "connection refused"]], + [-54, ["ECONNRESET", "connection reset by peer"]], + [-39, ["EDESTADDRREQ", "destination address required"]], + [-17, ["EEXIST", "file already exists"]], + [-14, ["EFAULT", "bad address in system call argument"]], + [-27, ["EFBIG", "file too large"]], + [-65, ["EHOSTUNREACH", "host is unreachable"]], + [-4, ["EINTR", "interrupted system call"]], + [-22, ["EINVAL", "invalid argument"]], + [-5, ["EIO", "i/o error"]], + [-56, ["EISCONN", "socket is already connected"]], + [-21, ["EISDIR", "illegal operation on a directory"]], + [-62, ["ELOOP", "too many symbolic links encountered"]], + [-24, ["EMFILE", "too many open files"]], + [-40, ["EMSGSIZE", "message too long"]], + [-63, ["ENAMETOOLONG", "name too long"]], + [-50, ["ENETDOWN", "network is down"]], + [-51, ["ENETUNREACH", "network is unreachable"]], + [-23, ["ENFILE", "file table overflow"]], + [-55, ["ENOBUFS", "no buffer space available"]], + [-19, ["ENODEV", "no such device"]], + [-2, ["ENOENT", "no such file or directory"]], + [-12, ["ENOMEM", "not enough memory"]], + [-4056, ["ENONET", "machine is not on the network"]], + [-42, ["ENOPROTOOPT", "protocol not available"]], + [-28, ["ENOSPC", "no space left on device"]], + [-78, ["ENOSYS", "function not implemented"]], + [-57, ["ENOTCONN", "socket is not connected"]], + [-20, ["ENOTDIR", "not a directory"]], + [-66, ["ENOTEMPTY", "directory not empty"]], + [-38, ["ENOTSOCK", "socket operation on non-socket"]], + [-45, ["ENOTSUP", "operation not supported on socket"]], + [-87, ["EOVERFLOW", "value too large for defined data type"]], + [-1, ["EPERM", "operation not permitted"]], + [-32, ["EPIPE", "broken pipe"]], + [-95, ["EPROTO", "protocol error"]], + [-43, ["EPROTONOSUPPORT", "protocol not supported"]], + [-41, ["EPROTOTYPE", "protocol wrong type for socket"]], + [-34, ["ERANGE", "result too large"]], + [-30, ["EROFS", "read-only file system"]], + [-58, ["ESHUTDOWN", "cannot send after transport endpoint shutdown"]], + [-29, ["ESPIPE", "invalid seek"]], + [-3, ["ESRCH", "no such process"]], + [-60, ["ETIMEDOUT", "connection timed out"]], + [-26, ["ETXTBSY", "text file is busy"]], + [-18, ["EXDEV", "cross-device link not permitted"]], + [-4094, ["UNKNOWN", "unknown error"]], + [-4095, ["EOF", "end of file"]], + [-6, ["ENXIO", "no such device or address"]], + [-31, ["EMLINK", "too many links"]], + [-64, ["EHOSTDOWN", "host is down"]], + [-4030, ["EREMOTEIO", "remote I/O error"]], + [-25, ["ENOTTY", "inappropriate ioctl for device"]], + [-79, ["EFTYPE", "inappropriate file type or format"]], + [-84, ["EILSEQ", "illegal byte sequence"]], + [-44, ["ESOCKTNOSUPPORT", "socket type not supported"]], +]; + +const errorToCodeOpenBSD: CodeMapData = codeToErrorOpenBSD.map(( + [status, [code]], +) => [code, status]); + export const errorMap = new Map<number, [string, string]>( osType === "windows" ? codeToErrorWindows @@ -404,6 +493,8 @@ export const errorMap = new Map<number, [string, string]>( ? codeToErrorLinux : osType === "freebsd" ? codeToErrorFreebsd + : osType === "openbsd" + ? codeToErrorOpenBSD : unreachable(), ); @@ -416,6 +507,8 @@ export const codeMap = new Map<string, number>( ? errorToCodeLinux : osType === "freebsd" ? errorToCodeFreebsd + : osType === "openbsd" + ? errorToCodeOpenBSD : unreachable(), ); diff --git a/ext/node/polyfills/os.ts b/ext/node/polyfills/os.ts index 19e8fd155..d9186159f 100644 --- a/ext/node/polyfills/os.ts +++ b/ext/node/polyfills/os.ts @@ -172,6 +172,7 @@ export function homedir(): string | null { case "linux": case "darwin": case "freebsd": + case "openbsd": return Deno.env.get("HOME") || null; default: throw Error("unreachable"); @@ -299,6 +300,8 @@ export function type(): string { return "Darwin"; case "freebsd": return "FreeBSD"; + case "openbsd": + return "OpenBSD"; default: throw Error("unreachable"); } |