diff options
-rw-r--r-- | runtime/doc/luvref.txt | 110 |
1 files changed, 99 insertions, 11 deletions
diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt index 859e75e4af..b7ce273f5f 100644 --- a/runtime/doc/luvref.txt +++ b/runtime/doc/luvref.txt @@ -24,7 +24,7 @@ be used in other Lua environments. More information about the core libuv library can be found at the original libuv documentation page (https://docs.libuv.org/). -TCP Echo Server Example~ +TCP Echo Server Example ~ Here is a small example showing a TCP echo server: @@ -51,15 +51,15 @@ Here is a small example showing a TCP echo server: uv.run() -- an explicit run call is necessary outside of luvit < -Module Layout~ +Module Layout ~ The luv library contains a single Lua module referred to hereafter as `uv` for simplicity. This module consists mostly of functions with names corresponding to their original libuv versions. For example, the libuv function -`uv_tcp_bind` has a luv version at |uv.tcp_bind()|. Currently, only one -non-function field exists: `uv.constants`, which is a table. +`uv_tcp_bind` has a luv version at |uv.tcp_bind()|. Currently, only two +non-function fields exists: `uv.constants` and `uv.errno`, which are tables. -Functions vs Methods~ +Functions vs Methods ~ In addition to having simple functions, luv provides an optional method-style API. For example, `uv.tcp_bind(server, host, port)` can alternatively be @@ -67,7 +67,7 @@ called as `server:bind(host, port)` . Note that the first argument `server` becomes the object and `tcp_` is removed from the function name. Method forms are documented below where they exist. -Synchronous vs Asynchronous Functions~ +Synchronous vs Asynchronous Functions ~ Functions that accept a callback are asynchronous. These functions may immediately return results to the caller to indicate their initial status, but @@ -82,7 +82,7 @@ Some (generally FS and DNS) functions can behave either synchronously or asynchronously. If a callback is provided to these functions, they behave asynchronously; if no callback is provided, they behave synchronously. -Pseudo-Types~ +Pseudo-Types ~ Some unique types are defined. These are not actual types in Lua, but they are used here to facilitate documenting consistent behavior: @@ -133,10 +133,10 @@ module. ============================================================================== ERROR HANDLING *luv-error-handling* -In libuv, errors are negative numbered constants; however, these errors and -the functions used to handle them are not exposed to luv users. Instead, if an -internal error is encountered, the luv function will return to the caller an -assertable `nil, err, name` tuple. +In libuv, errors are negative numbered constants; however, while those errors +are exposed through `uv.errno`, the functions used to handle them are not +exposed to luv users. Instead, if an internal error is encountered, the luv +function will return to the caller an assertable `nil, err, name` tuple. - `nil` idiomatically indicates failure - `err` is a string with the format `{name}: {message}` @@ -151,6 +151,94 @@ When a function is called successfully, it will return either a value that is relevant to the operation of the function, or the integer `0` to indicate success, or sometimes nothing at all. These cases are documented below. +`uv.errno` *uv.errno* + +A table value which exposes error constants as a map, where the key is the +error name (without the `UV_` prefix) and its value is a negative number. +See Libuv's "Error constants" page for further details. +(https://docs.libuv.org/en/v1.x/errors.html#error-constants) + +- `E2BIG`: argument list too long. +- `EACCES`: permission denied. +- `EADDRINUSE`: address already in use. +- `EADDRNOTAVAIL`: address not available. +- `EAFNOSUPPORT`: address family not supported. +- `EAGAIN`: resource temporarily unavailable. +- `EAI_ADDRFAMILY`: address family not supported. +- `EAI_AGAIN`: temporary failure. +- `EAI_BADFLAGS`: bad ai_flags value. +- `EAI_BADHINTS`: invalid value for hints. +- `EAI_CANCELED`: request canceled. +- `EAI_FAIL`: permanent failure. +- `EAI_FAMILY`: ai_family not supported. +- `EAI_MEMORY`: out of memory. +- `EAI_NODATA`: no address. +- `EAI_NONAME`: unknown node or service. +- `EAI_OVERFLOW`: argument buffer overflow. +- `EAI_PROTOCOL`: resolved protocol is unknown. +- `EAI_SERVICE`: service not available for socket type. +- `EAI_SOCKTYPE`: socket type not supported. +- `EALREADY`: connection already in progress. +- `EBADF`: bad file descriptor. +- `EBUSY`: resource busy or locked. +- `ECANCELED`: operation canceled. +- `ECHARSET`: invalid Unicode character. +- `ECONNABORTED`: software caused connection abort. +- `ECONNREFUSED`: connection refused. +- `ECONNRESET`: connection reset by peer. +- `EDESTADDRREQ`: destination address required. +- `EEXIST`: file already exists. +- `EFAULT`: bad address in system call argument. +- `EFBIG`: file too large. +- `EHOSTUNREACH`: host is unreachable. +- `EINTR`: interrupted system call. +- `EINVAL`: invalid argument. +- `EIO`: i/o error. +- `EISCONN`: socket is already connected. +- `EISDIR`: illegal operation on a directory. +- `ELOOP`: too many symbolic links encountered. +- `EMFILE`: too many open files. +- `EMSGSIZE`: message too long. +- `ENAMETOOLONG`: name too long. +- `ENETDOWN`: network is down. +- `ENETUNREACH`: network is unreachable. +- `ENFILE`: file table overflow. +- `ENOBUFS`: no buffer space available. +- `ENODEV`: no such device. +- `ENOENT`: no such file or directory. +- `ENOMEM`: not enough memory. +- `ENONET`: machine is not on the network. +- `ENOPROTOOPT`: protocol not available. +- `ENOSPC`: no space left on device. +- `ENOSYS`: function not implemented. +- `ENOTCONN`: socket is not connected. +- `ENOTDIR`: not a directory. +- `ENOTEMPTY`: directory not empty. +- `ENOTSOCK`: socket operation on non-socket. +- `ENOTSUP`: operation not supported on socket. +- `EOVERFLOW`: value too large for defined data type. +- `EPERM`: operation not permitted. +- `EPIPE`: broken pipe. +- `EPROTO`: protocol error. +- `EPROTONOSUPPORT`: protocol not supported. +- `EPROTOTYPE`: protocol wrong type for socket. +- `ERANGE`: result too large. +- `EROFS`: read-only file system. +- `ESHUTDOWN`: cannot send after transport endpoint shutdown. +- `ESPIPE`: invalid seek. +- `ESRCH`: no such process. +- `ETIMEDOUT`: connection timed out. +- `ETXTBSY`: text file is busy. +- `EXDEV`: cross-device link not permitted. +- `UNKNOWN`: unknown error. +- `EOF`: end of file. +- `ENXIO`: no such device or address. +- `EMLINK`: too many links. +- `ENOTTY`: inappropriate ioctl for device. +- `EFTYPE`: inappropriate file type or format. +- `EILSEQ`: illegal byte sequence. +- `ESOCKTNOSUPPORT`: socket type not supported. + ============================================================================== VERSION CHECKING *luv-version-checking* |