From 633c62819c01a90117225d187cceb6a9efd2fbca Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 18 Jan 2023 08:31:23 -0800 Subject: [PATCH] Remove errno codes that aren't used by filesystem APIs. (#80) * Remove errno codes that aren't used by filesystem APIs. Instead of WASI having a single errno space, each WASI interface defines its own error types. POSIX compatibility is provided by the libc layer. Codes used in filesystem APIs but not relevant to WASI: - nfile - This may be reported by libc, but wasi-filesystem itself doesn't because it will let the handle mechanism take care of everything. - mfile - WASI programs should not be able to observe "the system" having an open-file limit. - fault - This is used in POSIX to report invalid pointers, however in WASI that's handled in the bindings layer instead of in individual interfaces. Codes only used in network APIs (these will be defined in wasi-sockets): - afnosupport - addrinuse - addrnotavail - noprotoopt - destaddrreq - hostunreach - isconn - connaborted - connrefused - connreset - netdown - netreset - netunreach - timedout - multihop - nobufs Codes only used in other non-filesystem APIs: - toobig - badmsg - canceled - idrm - noexec - nolink - nomsg - ownerdead - range - srch - stale * Update wasi-filesystem.abi.md. --- wasi-filesystem.abi.md | 120 ----------------------------------------- wasi-filesystem.wit.md | 60 --------------------- 2 files changed, 180 deletions(-) diff --git a/wasi-filesystem.abi.md b/wasi-filesystem.abi.md index d709077..bc5fee0 100644 --- a/wasi-filesystem.abi.md +++ b/wasi-filesystem.abi.md @@ -311,26 +311,10 @@ Size: 1, Alignment: 1 ### Enum Cases -- [`toobig`](#errno.toobig) - - Argument list too long. This is similar to `E2BIG` in POSIX. - - [`access`](#errno.access) Permission denied. -- [`addrinuse`](#errno.addrinuse) - - Address in use. - -- [`addrnotavail`](#errno.addrnotavail) - - Address not available. - -- [`afnosupport`](#errno.afnosupport) - - Address family not supported. - - [`again`](#errno.again) Resource unavailable, or operation would block. @@ -343,42 +327,18 @@ Size: 1, Alignment: 1 Bad descriptor. -- [`badmsg`](#errno.badmsg) - - Bad message. - - [`busy`](#errno.busy) Device or resource busy. -- [`canceled`](#errno.canceled) - - Operation canceled. - - [`child`](#errno.child) No child processes. -- [`connaborted`](#errno.connaborted) - - Connection aborted. - -- [`connrefused`](#errno.connrefused) - - Connection refused. - -- [`connreset`](#errno.connreset) - - Connection reset. - - [`deadlk`](#errno.deadlk) Resource deadlock would occur. -- [`destaddrreq`](#errno.destaddrreq) - - Destination address required. - - [`dquot`](#errno.dquot) Storage quota exceeded. @@ -387,22 +347,10 @@ Size: 1, Alignment: 1 File exists. -- [`fault`](#errno.fault) - - Bad address. - - [`fbig`](#errno.fbig) File too large. -- [`hostunreach`](#errno.hostunreach) - - Host is unreachable. - -- [`idrm`](#errno.idrm) - - Identifier removed. - - [`ilseq`](#errno.ilseq) Illegal byte sequence. @@ -423,10 +371,6 @@ Size: 1, Alignment: 1 I/O error. -- [`isconn`](#errno.isconn) - - Socket is connected. - - [`isdir`](#errno.isdir) Is a directory. @@ -435,10 +379,6 @@ Size: 1, Alignment: 1 Too many levels of symbolic links. -- [`mfile`](#errno.mfile) - - File descriptor value too large. - - [`mlink`](#errno.mlink) Too many links. @@ -447,34 +387,10 @@ Size: 1, Alignment: 1 Message too large. -- [`multihop`](#errno.multihop) - - Multihop attempted. - - [`nametoolong`](#errno.nametoolong) Filename too long. -- [`netdown`](#errno.netdown) - - Network is down. - -- [`netreset`](#errno.netreset) - - Connection aborted by network. - -- [`netunreach`](#errno.netunreach) - - Network unreachable. - -- [`nfile`](#errno.nfile) - - Too many files open in system. - -- [`nobufs`](#errno.nobufs) - - No buffer space available. - - [`nodev`](#errno.nodev) No such device. @@ -483,30 +399,14 @@ Size: 1, Alignment: 1 No such file or directory. -- [`noexec`](#errno.noexec) - - Executable file format error. - - [`nolck`](#errno.nolck) No locks available. -- [`nolink`](#errno.nolink) - - Link has been severed. - - [`nomem`](#errno.nomem) Not enough space. -- [`nomsg`](#errno.nomsg) - - No message of the desired type. - -- [`noprotoopt`](#errno.noprotoopt) - - Protocol not available. - - [`nospc`](#errno.nospc) No space left on device. @@ -543,10 +443,6 @@ Size: 1, Alignment: 1 Value too large to be stored in data type. -- [`ownerdead`](#errno.ownerdead) - - Previous owner died. - - [`perm`](#errno.perm) Operation not permitted. @@ -555,10 +451,6 @@ Size: 1, Alignment: 1 Broken pipe. -- [`range`](#errno.range) - - Result too large. - - [`rofs`](#errno.rofs) Read-only file system. @@ -567,18 +459,6 @@ Size: 1, Alignment: 1 Invalid seek. -- [`srch`](#errno.srch) - - No such process. - -- [`stale`](#errno.stale) - - Stale file handle. - -- [`timedout`](#errno.timedout) - - Connection timed out. - - [`txtbsy`](#errno.txtbsy) Text file busy. diff --git a/wasi-filesystem.wit.md b/wasi-filesystem.wit.md index 2a6351c..424bd22 100644 --- a/wasi-filesystem.wit.md +++ b/wasi-filesystem.wit.md @@ -218,52 +218,26 @@ record dir-entry { /// API; some are used in higher-level library layers, and others are provided /// merely for alignment with POSIX. enum errno { - /// Argument list too long. This is similar to `E2BIG` in POSIX. - toobig, /// Permission denied. access, - /// Address in use. - addrinuse, - /// Address not available. - addrnotavail, - /// Address family not supported. - afnosupport, /// Resource unavailable, or operation would block. again, /// Connection already in progress. already, /// Bad descriptor. badf, - /// Bad message. - badmsg, /// Device or resource busy. busy, - /// Operation canceled. - canceled, /// No child processes. child, - /// Connection aborted. - connaborted, - /// Connection refused. - connrefused, - /// Connection reset. - connreset, /// Resource deadlock would occur. deadlk, - /// Destination address required. - destaddrreq, /// Storage quota exceeded. dquot, /// File exists. exist, - /// Bad address. - fault, /// File too large. fbig, - /// Host is unreachable. - hostunreach, - /// Identifier removed. - idrm, /// Illegal byte sequence. ilseq, /// Operation in progress. @@ -274,48 +248,24 @@ enum errno { inval, /// I/O error. io, - /// Socket is connected. - isconn, /// Is a directory. isdir, /// Too many levels of symbolic links. loop, - /// File descriptor value too large. - mfile, /// Too many links. mlink, /// Message too large. msgsize, - /// Multihop attempted. - multihop, /// Filename too long. nametoolong, - /// Network is down. - netdown, - /// Connection aborted by network. - netreset, - /// Network unreachable. - netunreach, - /// Too many files open in system. - nfile, - /// No buffer space available. - nobufs, /// No such device. nodev, /// No such file or directory. noent, - /// Executable file format error. - noexec, /// No locks available. nolck, - /// Link has been severed. - nolink, /// Not enough space. nomem, - /// No message of the desired type. - nomsg, - /// Protocol not available. - noprotoopt, /// No space left on device. nospc, /// Function not supported. @@ -334,24 +284,14 @@ enum errno { nxio, /// Value too large to be stored in data type. overflow, - /// Previous owner died. - ownerdead, /// Operation not permitted. perm, /// Broken pipe. pipe, - /// Result too large. - range, /// Read-only file system. rofs, /// Invalid seek. spipe, - /// No such process. - srch, - /// Stale file handle. - stale, - /// Connection timed out. - timedout, /// Text file busy. txtbsy, /// Cross-device link.