Home Explore Blog CI



neovim

3rd chunk of `runtime/doc/luvref.txt`
2cf95cedaefb7adcb5c38d23e43a28ed95916723ccab66c70000000100000fa7
 signal start with integer input
  uv.signal_start(uv.constants.SIGTERM, function(signame)
    print(signame) -- string output: "sigterm"
  end)
<
The uppercase constants defined in `uv.constants` that have associated
lowercase option strings are listed below.

Address Families ~

- `AF_UNIX`: "unix"
- `AF_INET`: "inet"
- `AF_INET6`: "inet6"
- `AF_IPX`: "ipx"
- `AF_NETLINK`: "netlink"
- `AF_X25`: "x25"
- `AF_AX25`: "as25"
- `AF_ATMPVC`: "atmpvc"
- `AF_APPLETALK`: "appletalk"
- `AF_PACKET`: "packet"

Signals ~

- `SIGHUP`: "sighup"
- `SIGINT`: "sigint"
- `SIGQUIT`: "sigquit"
- `SIGILL`: "sigill"
- `SIGTRAP`: "sigtrap"
- `SIGABRT`: "sigabrt"
- `SIGIOT`: "sigiot"
- `SIGBUS`: "sigbus"
- `SIGFPE`: "sigfpe"
- `SIGKILL`: "sigkill"
- `SIGUSR1`: "sigusr1"
- `SIGSEGV`: "sigsegv"
- `SIGUSR2`: "sigusr2"
- `SIGPIPE`: "sigpipe"
- `SIGALRM`: "sigalrm"
- `SIGTERM`: "sigterm"
- `SIGCHLD`: "sigchld"
- `SIGSTKFLT`: "sigstkflt"
- `SIGCONT`: "sigcont"
- `SIGSTOP`: "sigstop"
- `SIGTSTP`: "sigtstp"
- `SIGBREAK`: "sigbreak"
- `SIGTTIN`: "sigttin"
- `SIGTTOU`: "sigttou"
- `SIGURG`: "sigurg"
- `SIGXCPU`: "sigxcpu"
- `SIGXFSZ`: "sigxfsz"
- `SIGVTALRM`: "sigvtalrm"
- `SIGPROF`: "sigprof"
- `SIGWINCH`: "sigwinch"
- `SIGIO`: "sigio"
- `SIGPOLL`: "sigpoll"
- `SIGLOST`: "siglost"
- `SIGPWR`: "sigpwr"
- `SIGSYS`: "sigsys"

Socket Types ~

- `SOCK_STREAM`: "stream"
- `SOCK_DGRAM`: "dgram"
- `SOCK_SEQPACKET`: "seqpacket"
- `SOCK_RAW`: "raw"
- `SOCK_RDM`: "rdm"

TTY Modes ~

- `TTY_MODE_NORMAL`: "normal"
- `TTY_MODE_RAW`: "raw"
- `TTY_MODE_IO`: "io"
 `TTY_MODE_RAW_VT`: "raw_vt"

FS Modification Times ~

- `FS_UTIME_NOW`: "now"
- `FS_UTIME_OMIT`: "omit"

==============================================================================
ERROR HANDLING                                              *luv-error-handling*

In libuv, errors are represented by negative numbered constants. While these
constants are made available in the `uv.errno` table, they are not returned by
luv functions and the libuv functions used to handle them are not exposed.
Instead, if an internal error is encountered, the failing 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}`
  - `{name}` is the error name provided internally by `uv_err_name`
  - `{message}` is a human-readable message provided internally by
    `uv_strerror`
- `name` is the same string used to construct `err`

This tuple is referred to below as the `fail` pseudo-type.

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*

Below is a list of known error names and error strings. 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

Title: Luv Constants and Error Handling
Summary
This section continues listing Luv constants with their string equivalents, covering signals, socket types, TTY modes, and FS modification times. It then details Luv's error handling mechanism, where errors are returned as a `nil, err, name` tuple, and lists known error names and messages available in the `uv.errno` table.