wa-lang.org/wazero@v1.0.2/imports/wasi_snapshot_preview1/errno.go (about)

     1  package wasi_snapshot_preview1
     2  
     3  import (
     4  	internalwasi "wa-lang.org/wazero/internal/wasi_snapshot_preview1"
     5  )
     6  
     7  // Errno are the error codes returned by WASI functions.
     8  //
     9  // # Notes
    10  //
    11  //   - This is not always an error, as ErrnoSuccess is a valid code.
    12  //   - Codes are defined even when not relevant to WASI for use in higher-level
    13  //     libraries or alignment with POSIX.
    14  //
    15  // See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-errno-enumu16 and
    16  // https://linux.die.net/man/3/errno
    17  type Errno = uint32 // neither uint16 nor an alias for parity with wasm.ValueType
    18  
    19  // ErrnoName returns the POSIX error code name, except ErrnoSuccess, which is not an error. e.g. Errno2big -> "E2BIG"
    20  func ErrnoName(errno Errno) string {
    21  	return internalwasi.ErrnoName(errno)
    22  }
    23  
    24  // Note: Below prefers POSIX symbol names over WASI ones, even if the docs are from WASI.
    25  // See https://linux.die.net/man/3/errno
    26  // See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#variants-1
    27  const (
    28  	// ErrnoSuccess No error occurred. System call completed successfully.
    29  	ErrnoSuccess Errno = iota
    30  	// Errno2big Argument list too long.
    31  	Errno2big
    32  	// ErrnoAcces Permission denied.
    33  	ErrnoAcces
    34  	// ErrnoAddrinuse Address in use.
    35  	ErrnoAddrinuse
    36  	// ErrnoAddrnotavail Address not available.
    37  	ErrnoAddrnotavail
    38  	// ErrnoAfnosupport Address family not supported.
    39  	ErrnoAfnosupport
    40  	// ErrnoAgain Resource unavailable, or operation would block.
    41  	ErrnoAgain
    42  	// ErrnoAlready Connection already in progress.
    43  	ErrnoAlready
    44  	// ErrnoBadf Bad file descriptor.
    45  	ErrnoBadf
    46  	// ErrnoBadmsg Bad message.
    47  	ErrnoBadmsg
    48  	// ErrnoBusy Device or resource busy.
    49  	ErrnoBusy
    50  	// ErrnoCanceled Operation canceled.
    51  	ErrnoCanceled
    52  	// ErrnoChild No child processes.
    53  	ErrnoChild
    54  	// ErrnoConnaborted Connection aborted.
    55  	ErrnoConnaborted
    56  	// ErrnoConnrefused Connection refused.
    57  	ErrnoConnrefused
    58  	// ErrnoConnreset Connection reset.
    59  	ErrnoConnreset
    60  	// ErrnoDeadlk Resource deadlock would occur.
    61  	ErrnoDeadlk
    62  	// ErrnoDestaddrreq Destination address required.
    63  	ErrnoDestaddrreq
    64  	// ErrnoDom Mathematics argument out of domain of function.
    65  	ErrnoDom
    66  	// ErrnoDquot Reserved.
    67  	ErrnoDquot
    68  	// ErrnoExist File exists.
    69  	ErrnoExist
    70  	// ErrnoFault Bad address.
    71  	ErrnoFault
    72  	// ErrnoFbig File too large.
    73  	ErrnoFbig
    74  	// ErrnoHostunreach Host is unreachable.
    75  	ErrnoHostunreach
    76  	// ErrnoIdrm Identifier removed.
    77  	ErrnoIdrm
    78  	// ErrnoIlseq Illegal byte sequence.
    79  	ErrnoIlseq
    80  	// ErrnoInprogress Operation in progress.
    81  	ErrnoInprogress
    82  	// ErrnoIntr Interrupted function.
    83  	ErrnoIntr
    84  	// ErrnoInval Invalid argument.
    85  	ErrnoInval
    86  	// ErrnoIo I/O error.
    87  	ErrnoIo
    88  	// ErrnoIsconn Socket is connected.
    89  	ErrnoIsconn
    90  	// ErrnoIsdir Is a directory.
    91  	ErrnoIsdir
    92  	// ErrnoLoop Too many levels of symbolic links.
    93  	ErrnoLoop
    94  	// ErrnoMfile File descriptor value too large.
    95  	ErrnoMfile
    96  	// ErrnoMlink Too many links.
    97  	ErrnoMlink
    98  	// ErrnoMsgsize Message too large.
    99  	ErrnoMsgsize
   100  	// ErrnoMultihop Reserved.
   101  	ErrnoMultihop
   102  	// ErrnoNametoolong Filename too long.
   103  	ErrnoNametoolong
   104  	// ErrnoNetdown Network is down.
   105  	ErrnoNetdown
   106  	// ErrnoNetreset Connection aborted by network.
   107  	ErrnoNetreset
   108  	// ErrnoNetunreach Network unreachable.
   109  	ErrnoNetunreach
   110  	// ErrnoNfile Too many files open in system.
   111  	ErrnoNfile
   112  	// ErrnoNobufs No buffer space available.
   113  	ErrnoNobufs
   114  	// ErrnoNodev No such device.
   115  	ErrnoNodev
   116  	// ErrnoNoent No such file or directory.
   117  	ErrnoNoent
   118  	// ErrnoNoexec Executable file format error.
   119  	ErrnoNoexec
   120  	// ErrnoNolck No locks available.
   121  	ErrnoNolck
   122  	// ErrnoNolink Reserved.
   123  	ErrnoNolink
   124  	// ErrnoNomem Not enough space.
   125  	ErrnoNomem
   126  	// ErrnoNomsg No message of the desired type.
   127  	ErrnoNomsg
   128  	// ErrnoNoprotoopt No message of the desired type.
   129  	ErrnoNoprotoopt
   130  	// ErrnoNospc No space left on device.
   131  	ErrnoNospc
   132  	// ErrnoNosys function not supported.
   133  	ErrnoNosys
   134  	// ErrnoNotconn The socket is not connected.
   135  	ErrnoNotconn
   136  	// ErrnoNotdir Not a directory or a symbolic link to a directory.
   137  	ErrnoNotdir
   138  	// ErrnoNotempty Directory not empty.
   139  	ErrnoNotempty
   140  	// ErrnoNotrecoverable State not recoverable.
   141  	ErrnoNotrecoverable
   142  	// ErrnoNotsock Not a socket.
   143  	ErrnoNotsock
   144  	// ErrnoNotsup Not supported, or operation not supported on socket.
   145  	ErrnoNotsup
   146  	// ErrnoNotty Inappropriate I/O control operation.
   147  	ErrnoNotty
   148  	// ErrnoNxio No such device or address.
   149  	ErrnoNxio
   150  	// ErrnoOverflow Value too large to be stored in data type.
   151  	ErrnoOverflow
   152  	// ErrnoOwnerdead Previous owner died.
   153  	ErrnoOwnerdead
   154  	// ErrnoPerm Operation not permitted.
   155  	ErrnoPerm
   156  	// ErrnoPipe Broken pipe.
   157  	ErrnoPipe
   158  	// ErrnoProto Protocol error.
   159  	ErrnoProto
   160  	// ErrnoProtonosupport Protocol error.
   161  	ErrnoProtonosupport
   162  	// ErrnoPrototype Protocol wrong type for socket.
   163  	ErrnoPrototype
   164  	// ErrnoRange Result too large.
   165  	ErrnoRange
   166  	// ErrnoRofs Read-only file system.
   167  	ErrnoRofs
   168  	// ErrnoSpipe Invalid seek.
   169  	ErrnoSpipe
   170  	// ErrnoSrch No such process.
   171  	ErrnoSrch
   172  	// ErrnoStale Reserved.
   173  	ErrnoStale
   174  	// ErrnoTimedout Connection timed out.
   175  	ErrnoTimedout
   176  	// ErrnoTxtbsy Text file busy.
   177  	ErrnoTxtbsy
   178  	// ErrnoXdev Cross-device link.
   179  	ErrnoXdev
   180  
   181  	// Note: ErrnoNotcapable was removed by WASI maintainers.
   182  	// See https://github.com/WebAssembly/wasi-libc/pull/294
   183  )