Home Explore Blog CI



neovim

20th chunk of `runtime/doc/luvref.txt`
64c9cdc16a871e45840005dcf7784cdeca0bc63d47a928d60000000100000fa6
 `uv_process_t userdata`
                - `signame`: `string` or `integer` or `nil` (default: `sigterm`)

                Sends the specified signal to the given process handle. Check
                the documentation on |uv_signal_t| for signal support,
                specially on Windows.

                See |luv-constants| for supported `signame` input and output
                values.

                Returns: `0` or `fail`

uv.kill({pid}, {signame})                                             *uv.kill()*

                Parameters:
                - `pid`: `integer`
                - `signame`: `string` or `integer` or `nil` (default: `sigterm`)

                Sends the specified signal to the given PID. Check the
                documentation on |uv_signal_t| for signal support, specially
                on Windows.

                See |luv-constants| for supported `signame` input and output
                values.

                Returns: `0` or `fail`

uv.process_get_pid({process})                             *uv.process_get_pid()*

                > method form `process:get_pid()`

                Parameters:
                - `process`: `uv_process_t userdata`

                Returns the handle's pid.

                Returns: `integer`

==============================================================================
`uv_stream_t` — Stream handle                      *luv-stream-handle* *uv_stream_t*

> |uv_handle_t| functions also apply.

Stream handles provide an abstraction of a duplex communication channel.
`uv_stream_t` is an abstract type, libuv provides 3 stream implementations
in the form of |uv_tcp_t|, |uv_pipe_t| and |uv_tty_t|.

uv.shutdown({stream} [, {callback}])                             *uv.shutdown()*

                > method form `stream:shutdown([callback])`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `callback`: `callable` or `nil`
                  - `err`: `nil` or `string`

                Shutdown the outgoing (write) side of a duplex stream. It
                waits for pending write requests to complete. The callback is
                called after shutdown is complete.

                Returns: `uv_shutdown_t userdata` or `fail`

uv.listen({stream}, {backlog}, {callback})                         *uv.listen()*

                > method form `stream:listen(backlog, callback)`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `backlog`: `integer`
                - `callback`: `callable`
                  - `err`: `nil` or `string`

                Start listening for incoming connections. `backlog` indicates
                the number of connections the kernel might queue, same as
                `listen(2)`. When a new incoming connection is received the
                callback is called.

                Returns: `0` or `fail`

uv.accept({stream}, {client_stream})                               *uv.accept()*

                > method form `stream:accept(client_stream)`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `client_stream`: `userdata` for sub-type of |uv_stream_t|

                This call is used in conjunction with |uv.listen()| to accept
                incoming connections. Call this function after receiving a
                callback to accept the connection.

                When the connection callback is called it is guaranteed that
                this function will complete successfully the first time. If
                you attempt to use it more than once, it may fail. It is
                suggested to only call this function once per connection call.

                Returns: `0` or `fail`

                    >lua
                    server:listen(128, function (err)
                      local client = uv.new_tcp()
                      server:accept(client)

Title: Libuv Process and Stream Handling Functions
Summary
This section outlines several libuv functions related to process and stream management. It details `uv.process_get_pid()`, which retrieves the process ID of a given process handle. It then introduces `uv_stream_t`, an abstract type representing a duplex communication channel implemented by `uv_tcp_t`, `uv_pipe_t`, and `uv_tty_t`. The section describes `uv.shutdown()`, used to close the writing side of a stream, `uv.listen()`, which enables listening for incoming connections on a stream, and `uv.accept()`, which accepts an incoming connection in conjunction with `uv.listen()`.