fix(meta.uv): update file to latest and suppress deprecation warnings
This commit is contained in:
+328
-123
@@ -1,4 +1,5 @@
|
||||
---@alias vim.uv uv
|
||||
---@diagnostic disable: deprecated
|
||||
|
||||
-- source: https://github.com/Bilal2453/luvit-meta
|
||||
--[[
|
||||
@@ -287,7 +288,7 @@
|
||||
--- metamethod
|
||||
---- `buffer`: a `string` or a sequential `table` of `string`s
|
||||
---- `threadargs`: variable arguments (`...`) of type `nil`, `boolean`, `number`,
|
||||
--- `string`, or `userdata`
|
||||
--- `string`, or `userdata`, numbers of argument limited to 9.
|
||||
---
|
||||
---@namespace
|
||||
---@class uv
|
||||
@@ -296,7 +297,9 @@ local uv = {}
|
||||
|
||||
---@alias uv.aliases.buffer string|string[]
|
||||
|
||||
---@alias uv.aliases.threadargs userdata|string|number|boolean|nil
|
||||
---@alias uv.aliases.threadargs userdata|string|number|boolean|nil # numbers of argument limited to 9.
|
||||
|
||||
|
||||
|
||||
---
|
||||
---@section Contents
|
||||
@@ -336,6 +339,8 @@ local uv = {}
|
||||
|
||||
-- TODO: above section should probably not be hardcoded
|
||||
|
||||
|
||||
|
||||
---
|
||||
---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
|
||||
@@ -368,6 +373,8 @@ local uv = {}
|
||||
---@type uv.errno
|
||||
uv.errno = {}
|
||||
|
||||
|
||||
|
||||
---
|
||||
---@section Version Checking
|
||||
---
|
||||
@@ -389,6 +396,8 @@ function uv.version() end
|
||||
---@nodiscard
|
||||
function uv.version_string() end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---The event loop is the central part of libuv's functionality. It takes care of
|
||||
-- polling for I/O and scheduling callbacks to be run based on different sources of events.
|
||||
@@ -564,6 +573,8 @@ function uv.update_time() end
|
||||
---@param callback fun(handle: uv.aliases.handle_instances)
|
||||
function uv.walk(callback) end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---`uv_req_t` is the base type for all libuv request types.
|
||||
---
|
||||
@@ -572,30 +583,30 @@ function uv.walk(callback) end
|
||||
local uv_req_t = {}
|
||||
|
||||
---@alias uv.aliases.req_struct_name
|
||||
---|'unknown' 0
|
||||
---|'req' 1
|
||||
---|'connect' 2
|
||||
---|'write' 3
|
||||
---|'shutdown' 4
|
||||
---|'udp_send' 5
|
||||
---|'fs' 6
|
||||
---|'work' 7
|
||||
---|'getaddrinfo' 8
|
||||
---|'getnameinfo' 9
|
||||
---|'random' 10
|
||||
---|'unknown' # 0
|
||||
---|'req' # 1
|
||||
---|'connect' # 2
|
||||
---|'write' # 3
|
||||
---|'shutdown' # 4
|
||||
---|'udp_send' # 5
|
||||
---|'fs' # 6
|
||||
---|'work' # 7
|
||||
---|'getaddrinfo' # 8
|
||||
---|'getnameinfo' # 9
|
||||
---|'random' # 10
|
||||
|
||||
---@alias uv.aliases.req_struct_type
|
||||
---|0 unknown
|
||||
---|1 req
|
||||
---|2 connect
|
||||
---|3 write
|
||||
---|4 shutdown
|
||||
---|5 udp_send
|
||||
---|6 fs
|
||||
---|7 work
|
||||
---|8 getaddrinfo
|
||||
---|9 getnameinfo
|
||||
---|10 random
|
||||
---|0 # unknown
|
||||
---|1 # req
|
||||
---|2 # connect
|
||||
---|3 # write
|
||||
---|4 # shutdown
|
||||
---|5 # udp_send
|
||||
---|6 # fs
|
||||
---|7 # work
|
||||
---|8 # getaddrinfo
|
||||
---|9 # getnameinfo
|
||||
---|10 # random
|
||||
|
||||
---
|
||||
---Cancel a pending request. Fails if the request is executing or has finished
|
||||
@@ -617,6 +628,8 @@ uv_req_t.cancel = uv.cancel
|
||||
function uv.req_get_type(req) end
|
||||
uv_req_t.get_type = uv.req_get_type
|
||||
|
||||
|
||||
|
||||
---
|
||||
---`uv_handle_t` is the base type for all libuv handle types. All API functions
|
||||
---defined here work with any handle type.
|
||||
@@ -636,44 +649,44 @@ local uv_handle_t = {}
|
||||
---|uv_fs_poll_t
|
||||
|
||||
---@alias uv.aliases.handle_struct_name
|
||||
---|'unknown' 0
|
||||
---|'"async"' 1
|
||||
---|'check' 2
|
||||
---|'fs_event' 3
|
||||
---|'fs_poll' 4
|
||||
---|'handle' 5
|
||||
---|'idle' 6
|
||||
---|'pipe' 7
|
||||
---|'poll' 8
|
||||
---|'prepare' 9
|
||||
---|'process' 10
|
||||
---|'stream' 11
|
||||
---|'tcp' 12
|
||||
---|'timer' 13
|
||||
---|'tty' 14
|
||||
---|'udp' 15
|
||||
---|'signal' 16
|
||||
---|'file' 17
|
||||
---|'unknown' # 0
|
||||
---|'"async"' # 1
|
||||
---|'check' # 2
|
||||
---|'fs_event' # 3
|
||||
---|'fs_poll' # 4
|
||||
---|'handle' # 5
|
||||
---|'idle' # 6
|
||||
---|'pipe' # 7
|
||||
---|'poll' # 8
|
||||
---|'prepare' # 9
|
||||
---|'process' # 10
|
||||
---|'stream' # 11
|
||||
---|'tcp' # 12
|
||||
---|'timer' # 13
|
||||
---|'tty' # 14
|
||||
---|'udp' # 15
|
||||
---|'signal' # 16
|
||||
---|'file' # 17
|
||||
|
||||
---@alias uv.aliases.handle_struct_type
|
||||
---|0 unknown
|
||||
---|1 async
|
||||
---|2 check
|
||||
---|3 fs_event
|
||||
---|4 fs_poll
|
||||
---|5 handle
|
||||
---|6 idle
|
||||
---|7 pipe
|
||||
---|8 poll
|
||||
---|9 prepare
|
||||
---|10 process
|
||||
---|11 stream
|
||||
---|12 tcp
|
||||
---|13 timer
|
||||
---|14 tty
|
||||
---|15 udp
|
||||
---|16 signal
|
||||
---|17 file
|
||||
---|0 # unknown
|
||||
---|1 # async
|
||||
---|2 # check
|
||||
---|3 # fs_event
|
||||
---|4 # fs_poll
|
||||
---|5 # handle
|
||||
---|6 # idle
|
||||
---|7 # pipe
|
||||
---|8 # poll
|
||||
---|9 # prepare
|
||||
---|10 # process
|
||||
---|11 # stream
|
||||
---|12 # tcp
|
||||
---|13 # timer
|
||||
---|14 # tty
|
||||
---|15 # udp
|
||||
---|16 # signal
|
||||
---|17 # file
|
||||
|
||||
---
|
||||
---Returns `true` if the handle is active, `false` if it's inactive. What "active”
|
||||
@@ -819,6 +832,8 @@ uv_handle_t.fileno = uv.fileno
|
||||
function uv.handle_get_type(handle) end
|
||||
uv_handle_t.get_type = uv.handle_get_type
|
||||
|
||||
|
||||
|
||||
---
|
||||
---@section Reference counting
|
||||
---
|
||||
@@ -834,6 +849,8 @@ uv_handle_t.get_type = uv.handle_get_type
|
||||
---more detailed explanation on what being active involves.
|
||||
---
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Timer handles are used to schedule callbacks to be called in the future.
|
||||
---
|
||||
@@ -944,6 +961,8 @@ uv_timer_t.get_repeat = uv.timer_get_repeat
|
||||
function uv.timer_get_due_in(timer) end
|
||||
uv_timer_t.get_due_in = uv.timer_get_due_in
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Prepare handles will run the given callback once per loop iteration, right
|
||||
---before polling for I/O.
|
||||
@@ -987,6 +1006,7 @@ uv_prepare_t.start = uv.prepare_start
|
||||
function uv.prepare_stop(prepare) end
|
||||
uv_prepare_t.stop = uv.prepare_stop
|
||||
|
||||
|
||||
---
|
||||
---Check handles will run the given callback once per loop iteration, right after
|
||||
---polling for I/O.
|
||||
@@ -1029,6 +1049,8 @@ uv_check_t.start = uv.check_start
|
||||
function uv.check_stop(check) end
|
||||
uv_check_t.stop = uv.check_stop
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Idle handles will run the given callback once per loop iteration, right before
|
||||
---the `uv_prepare_t` handles.
|
||||
@@ -1078,6 +1100,8 @@ uv_idle_t.start = uv.idle_start
|
||||
function uv.idle_stop(idle) end
|
||||
uv_idle_t.stop = uv.idle_stop
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Async handles allow the user to "wakeup" the event loop and get a callback
|
||||
---called from another thread.
|
||||
@@ -1131,6 +1155,8 @@ function uv.new_async(callback) end
|
||||
function uv.async_send(async, ...) end
|
||||
uv_async_t.send = uv.async_send
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Poll handles are used to watch file descriptors for readability and writability,
|
||||
---similar to the purpose of [poll(2)](http://linux.die.net/man/2/poll).
|
||||
@@ -1227,6 +1253,8 @@ uv_poll_t.start = uv.poll_start
|
||||
function uv.poll_stop(poll) end
|
||||
uv_poll_t.stop = uv.poll_stop
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Signal handles implement Unix style signal handling on a per-event loop bases.
|
||||
---
|
||||
@@ -1278,41 +1306,41 @@ uv_poll_t.stop = uv.poll_stop
|
||||
local uv_signal_t = {}
|
||||
|
||||
---@alias uv.aliases.signals
|
||||
---| "sigabrt" Abort signal from abort(3)
|
||||
---| "sigalrm" Timer signal from alarm(2)
|
||||
---| "sigbus" Bus error (bad memory access)
|
||||
---| "sigchld" Child stopped or terminated
|
||||
---| "sigcont" Continue if stopped
|
||||
---| "sigfpe" Floating-point exception
|
||||
---| "sighup" Hangup detected on controlling terminal or death of controlling process
|
||||
---| "sigill" Illegal Instruction
|
||||
---| "sigint" Interrupt from keyboard
|
||||
---| "sigio" I/O now possible (4.2BSD)
|
||||
---| "sigiot" IOT trap. A synonym for sigabrt
|
||||
---| "sigkill" Kill signal
|
||||
---| "sigpipe" Broken pipe: write to pipe with no readers; see pipe(7)
|
||||
---| "sigpoll" Pollable event (Sys V); synonym for sigIO
|
||||
---| "sigprof" Profiling timer expired
|
||||
---| "sigpwr" Power failure (System V)
|
||||
---| "sigquit" Quit from keyboard
|
||||
---| "sigsegv" Invalid memory reference
|
||||
---| "sigstkflt" Stack fault on coprocessor
|
||||
---| "sigstop" Stop process
|
||||
---| "sigtstp" Stop typed at terminal
|
||||
---| "sigsys" Bad system call (SVr4); see also seccomp(2)
|
||||
---| "sigterm" Termination signal
|
||||
---| "sigtrap" Trace/breakpoint trap
|
||||
---| "sigttin" Terminal input for background process
|
||||
---| "sigttou" Terminal output for background process
|
||||
---| "sigurg" Urgent condition on socket (4.2BSD)
|
||||
---| "sigusr1" User-defined signal 1
|
||||
---| "sigusr2" User-defined signal 2
|
||||
---| "sigvtalrm" Virtual alarm clock (4.2BSD)
|
||||
---| "sigxcpu" CPU time limit exceeded (4.2BSD); see setrlimit(2)
|
||||
---| "sigxfsz" File size limit exceeded (4.2BSD);see setrlimit(2)
|
||||
---| "sigwinch" Window resize signal (4.3BSD, Sun)
|
||||
---| "sigbreak" CTRL + BREAK has been pressed
|
||||
---| "siglost" File lock lost
|
||||
---| "sigabrt" # Abort signal from abort(3)
|
||||
---| "sigalrm" # Timer signal from alarm(2)
|
||||
---| "sigbus" # Bus error (bad memory access)
|
||||
---| "sigchld" # Child stopped or terminated
|
||||
---| "sigcont" # Continue if stopped
|
||||
---| "sigfpe" # Floating-point exception
|
||||
---| "sighup" # Hangup detected on controlling terminal or death of controlling process
|
||||
---| "sigill" # Illegal Instruction
|
||||
---| "sigint" # Interrupt from keyboard
|
||||
---| "sigio" # I/O now possible (4.2BSD)
|
||||
---| "sigiot" # IOT trap. A synonym for sigabrt
|
||||
---| "sigkill" # Kill signal
|
||||
---| "sigpipe" # Broken pipe: write to pipe with no readers; see pipe(7)
|
||||
---| "sigpoll" # Pollable event (Sys V); synonym for sigIO
|
||||
---| "sigprof" # Profiling timer expired
|
||||
---| "sigpwr" # Power failure (System V)
|
||||
---| "sigquit" # Quit from keyboard
|
||||
---| "sigsegv" # Invalid memory reference
|
||||
---| "sigstkflt" # Stack fault on coprocessor
|
||||
---| "sigstop" # Stop process
|
||||
---| "sigtstp" # Stop typed at terminal
|
||||
---| "sigsys" # Bad system call (SVr4); see also seccomp(2)
|
||||
---| "sigterm" # Termination signal
|
||||
---| "sigtrap" # Trace/breakpoint trap
|
||||
---| "sigttin" # Terminal input for background process
|
||||
---| "sigttou" # Terminal output for background process
|
||||
---| "sigurg" # Urgent condition on socket (4.2BSD)
|
||||
---| "sigusr1" # User-defined signal 1
|
||||
---| "sigusr2" # User-defined signal 2
|
||||
---| "sigvtalrm" # Virtual alarm clock (4.2BSD)
|
||||
---| "sigxcpu" # CPU time limit exceeded (4.2BSD); see setrlimit(2)
|
||||
---| "sigxfsz" # File size limit exceeded (4.2BSD);see setrlimit(2)
|
||||
---| "sigwinch" # Window resize signal (4.3BSD, Sun)
|
||||
---| "sigbreak" # CTRL + BREAK has been pressed
|
||||
---| "siglost" # File lock lost
|
||||
|
||||
---
|
||||
---Creates and initializes a new `uv_signal_t`.
|
||||
@@ -1354,6 +1382,8 @@ uv_signal_t.start_oneshot = uv.signal_start_oneshot
|
||||
function uv.signal_stop(signal) end
|
||||
uv_signal_t.stop = uv.signal_stop
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Process handles will spawn a new process and allow the user to control it and
|
||||
---establish communication channels with it using streams.
|
||||
@@ -1435,10 +1465,11 @@ function uv.disable_stdio_inheritance() end
|
||||
---
|
||||
---The `options` table accepts the following fields:
|
||||
---
|
||||
--- - `options.args` - Command line arguments as a list of string. The first
|
||||
---string should be the path to the program. On Windows, this uses CreateProcess
|
||||
---which concatenates the arguments into a string. This can cause some strange
|
||||
---errors. (See `options.verbatim` below for Windows.)
|
||||
--- - `options.args` - Command line arguments as a list of strings. The first
|
||||
--- string should *not* be the path to the program, since that is already
|
||||
--- provided via `path`. On Windows, this uses CreateProcess which concatenates
|
||||
--- the arguments into a string. This can cause some strange errors
|
||||
--- (see `options.verbatim` below for Windows).
|
||||
---
|
||||
--- - `options.stdio` - Set the file descriptors that will be made available to
|
||||
--- the child process. The convention is that the first entries are stdin, stdout,
|
||||
@@ -1512,6 +1543,8 @@ function uv.kill(pid, signum) end
|
||||
function uv.process_get_pid(process) end
|
||||
uv_process_t.get_pid = uv.process_get_pid
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Stream handles provide an abstraction of a duplex communication channel.
|
||||
---`uv_stream_t` is an abstract type, libuv provides 3 stream implementations
|
||||
@@ -1698,6 +1731,8 @@ uv_stream_t.set_blocking = uv.stream_set_blocking
|
||||
function uv.stream_get_write_queue_size() end
|
||||
uv_stream_t.get_write_queue_size = uv.stream_get_write_queue_size
|
||||
|
||||
|
||||
|
||||
---
|
||||
---TCP handles are used to represent both TCP streams and servers.
|
||||
---
|
||||
@@ -2047,6 +2082,8 @@ uv_tcp_t.close_reset = uv.tcp_close_reset
|
||||
---@return {[1]: integer, [2]: integer}|nil, string? err_name, string? err_msg # [1, 2] file descriptor
|
||||
function uv.socketpair(socktype, protocol, flags1, flags2) end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Pipe handles provide an abstraction over local domain sockets on Unix and named pipes on Windows.
|
||||
---
|
||||
@@ -2077,6 +2114,8 @@ local uv_pipe_t = {}
|
||||
|
||||
---@alias uv.aliases.pipe_rtn {read: integer, write: integer}
|
||||
|
||||
---@alias uv.aliases.pipe_2_flags {no_truncate: boolean}
|
||||
|
||||
---
|
||||
---Creates and initializes a new `uv_pipe_t`. Returns the Lua userdata wrapping
|
||||
---it. The `ipc` argument is a boolean to indicate if this pipe will be used for
|
||||
@@ -2223,6 +2262,57 @@ uv_pipe_t.chmod = uv.pipe_chmod
|
||||
---@nodiscard
|
||||
function uv.pipe(read_flags, write_flags) end
|
||||
|
||||
---
|
||||
---Bind the pipe to a file path (Unix) or a name (Windows).
|
||||
---
|
||||
---`Flags`:
|
||||
---
|
||||
--- - If `type(flags)` is `number`, it must be `0` or `uv.constants.PIPE_NO_TRUNCATE`.
|
||||
--- - If `type(flags)` is `table`, it must be `{}` or `{ no_trunate = true|false }`.
|
||||
--- - If `type(flags)` is `nil`, it use default value `0`.
|
||||
--- - Returns `EINVAL` for unsupported flags without performing the bind operation.
|
||||
---
|
||||
---Supports Linux abstract namespace sockets. namelen must include the leading '\0' byte but not the trailing nul byte.
|
||||
---
|
||||
---**Note**:
|
||||
---1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
|
||||
---typically between 92 and 108 bytes.
|
||||
---2. New in version 1.46.0.
|
||||
---
|
||||
---@param pipe uv_pipe_t
|
||||
---@param name string
|
||||
---@param flags integer|uv.aliases.pipe_2_flags|nil # (default: 0)
|
||||
---@return 0|nil success, string? err_name, string? err_msg
|
||||
function uv.pipe_bind2(pipe, name, flags) end
|
||||
uv_pipe_t.bind2 = uv.pipe_bind2
|
||||
|
||||
---
|
||||
---Connect to the Unix domain socket or the named pipe.
|
||||
---
|
||||
---`Flags`:
|
||||
---
|
||||
--- - If `type(flags)` is `number`, it must be `0` or `uv.constants.PIPE_NO_TRUNCATE`.
|
||||
--- - If `type(flags)` is `table`, it must be `{}` or `{ no_trunate = true|false }`.
|
||||
--- - If `type(flags)` is `nil`, it use default value `0`.
|
||||
--- - Returns `EINVAL` for unsupported flags without performing the bind operation.
|
||||
---
|
||||
---Supports Linux abstract namespace sockets. namelen must include the leading nul byte but not the trailing nul byte.
|
||||
---
|
||||
---**Note**:
|
||||
---1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes,
|
||||
---typically between 92 and 108 bytes.
|
||||
---2. New in version 1.46.0.
|
||||
---
|
||||
---@param pipe uv_pipe_t
|
||||
---@param name string
|
||||
---@param flags integer|uv.aliases.pipe_2_flags|nil # (default: 0)
|
||||
---@param callback fun(err?: string)|nil
|
||||
---@return uv_connect_t|nil stream, string? err_name, string? err_msg
|
||||
function uv.pipe_connect2(pipe, name, flags, callback) end
|
||||
uv_pipe_t.connect2 = uv.pipe_connect2
|
||||
|
||||
|
||||
|
||||
---
|
||||
---TTY handles represent a stream for the console.
|
||||
---
|
||||
@@ -2330,6 +2420,8 @@ function uv.tty_set_vterm_state(state) end
|
||||
---@nodiscard
|
||||
function uv.tty_get_vterm_state() end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---UDP handles encapsulate UDP communication for both clients and servers.
|
||||
---
|
||||
@@ -2450,13 +2542,7 @@ uv_udp_t.getpeername = uv.udp_getpeername
|
||||
---@param interface_addr string|nil
|
||||
---@param membership uv.aliases.udp_membership
|
||||
---@return 0|nil success, string? err_name, string? err_msg
|
||||
function uv.udp_set_membership(
|
||||
udp,
|
||||
multicast_addr,
|
||||
interface_addr,
|
||||
membership
|
||||
)
|
||||
end
|
||||
function uv.udp_set_membership(udp, multicast_addr, interface_addr, membership) end
|
||||
uv_udp_t.set_membership = uv.udp_set_membership
|
||||
|
||||
---
|
||||
@@ -2470,14 +2556,7 @@ uv_udp_t.set_membership = uv.udp_set_membership
|
||||
---@param source_addr string
|
||||
---@param membership uv.aliases.udp_membership
|
||||
---@return 0|nil success, string? err_name, string? err_msg
|
||||
function uv.udp_set_source_membership(
|
||||
udp,
|
||||
multicast_addr,
|
||||
interface_addr,
|
||||
source_addr,
|
||||
membership
|
||||
)
|
||||
end
|
||||
function uv.udp_set_source_membership(udp, multicast_addr, interface_addr, source_addr, membership) end
|
||||
uv_udp_t.set_source_membership = uv.udp_set_source_membership
|
||||
|
||||
---
|
||||
@@ -2587,6 +2666,8 @@ uv_udp_t.recv_stop = uv.udp_recv_stop
|
||||
function uv.udp_connect(udp, host, port) end
|
||||
uv_udp_t.connect = uv.udp_connect
|
||||
|
||||
|
||||
|
||||
---
|
||||
---FS Event handles allow the user to monitor a given path for changes, for
|
||||
---example, if the file was renamed or there was a generic change in it. This
|
||||
@@ -2604,12 +2685,12 @@ local uv_fs_event_t = {}
|
||||
---Creates and initializes a new `uv_fs_event_t`.
|
||||
---Returns the Lua userdata wrapping it.
|
||||
---
|
||||
---@return uv_fs_event_t
|
||||
---@return uv_fs_event_t|nil, string? err_name, string? err_msg
|
||||
---@nodiscard
|
||||
function uv.new_fs_event() end
|
||||
|
||||
-- TODO: make sure that the above method can indeed return nil + error.
|
||||
-- confirmed to never return error see libuv/unix/linux-inotify (kqueue/sunos etc)
|
||||
-- can fail in case the feature is not supported, see unix/no-fsevents.c
|
||||
|
||||
---
|
||||
---Start the handle with the given callback, which will watch the specified path
|
||||
@@ -2638,6 +2719,8 @@ uv_fs_event_t.stop = uv.fs_event_stop
|
||||
function uv.fs_event_getpath() end
|
||||
uv_fs_event_t.getpath = uv.fs_event_getpath
|
||||
|
||||
|
||||
|
||||
---
|
||||
---FS Poll handles allow the user to monitor a given path for changes. Unlike
|
||||
---`uv_fs_event_t`, fs poll handles use `stat` to detect when a file has changed so
|
||||
@@ -2651,11 +2734,11 @@ local uv_fs_poll_t = {}
|
||||
---Creates and initializes a new `uv_fs_poll_t`.
|
||||
---Returns the Lua userdata wrapping it.
|
||||
---
|
||||
---@return uv_fs_poll_t|nil, string? err_name, string? err_msg
|
||||
---@return uv_fs_poll_t
|
||||
---@nodiscard
|
||||
function uv.new_fs_poll() end
|
||||
|
||||
-- TODO: make sure that the above methof can indeed return nil + error.
|
||||
-- TODO: make sure that the above method can indeed return nil + error.
|
||||
-- confirmed to never return error see libuv/fs-poll#uv_fs_poll_init
|
||||
|
||||
---
|
||||
@@ -2687,6 +2770,8 @@ uv_fs_poll_t.stop = uv.fs_poll_stop
|
||||
function uv.fs_poll_getpath() end
|
||||
uv_fs_poll_t.getpath = uv.fs_poll_getpath
|
||||
|
||||
|
||||
|
||||
---
|
||||
---@section File system operations
|
||||
---
|
||||
@@ -2867,7 +2952,7 @@ local luv_dir_t = {}
|
||||
---A bitwise OR mask.
|
||||
---|integer
|
||||
|
||||
---@alias uv.aliases.fs_readdir_entries {type: uv.aliases.fs_types, name: string}
|
||||
---@alias uv.aliases.fs_readdir_entries {type: uv.aliases.fs_types, name: string}[]
|
||||
|
||||
---@alias uv.aliases.fs_symlink_flags {dir: boolean, junction: boolean}
|
||||
|
||||
@@ -3547,7 +3632,7 @@ function uv.fs_opendir(path, entries, callback) end
|
||||
function uv.fs_opendir(path, entries) end
|
||||
|
||||
---
|
||||
---Iterates over the directory stream `uv_dir_t` returned by a successful
|
||||
---Iterates over the directory stream `luv_dir_t` returned by a successful
|
||||
---`uv.fs_opendir()` call. A table of data tables is returned where the number
|
||||
---of entries `n` is equal to or less than the `entries` parameter used in
|
||||
---the associated `uv.fs_opendir()` call.
|
||||
@@ -3586,6 +3671,8 @@ function uv.fs_statfs(path, callback) end
|
||||
---@nodiscard
|
||||
function uv.fs_statfs(path) end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Libuv provides a threadpool which can be used to run user code and get notified
|
||||
---in the loop thread. This threadpool is internally used to run all file system
|
||||
@@ -3638,6 +3725,8 @@ function uv.new_work(work_callback, after_work_callback) end
|
||||
function uv.queue_work(work_ctx, ...) end
|
||||
luv_work_ctx_t.queue = uv.queue_work
|
||||
|
||||
|
||||
|
||||
---
|
||||
---@section DNS utility functions
|
||||
---
|
||||
@@ -3679,6 +3768,8 @@ function uv.getnameinfo(address, callback) end
|
||||
---@return string|nil host, string service_or_errname, string? err_msg
|
||||
function uv.getnameinfo(address) end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---Libuv provides cross-platform implementations for multiple threading an
|
||||
--- synchronization primitives. The API largely follows the pthreads API.
|
||||
@@ -3687,6 +3778,8 @@ function uv.getnameinfo(address) end
|
||||
---@section Threading and synchronization utilities
|
||||
local luv_thread_t = {}
|
||||
|
||||
---@alias uv.aliases.thread_affinity {[integer]: boolean}
|
||||
|
||||
---
|
||||
---Creates and initializes a `luv_thread_t` (not `uv_thread_t`). Returns the Lua
|
||||
---userdata wrapping it and asynchronously executes `entry`, which can be
|
||||
@@ -3694,20 +3787,22 @@ local luv_thread_t = {}
|
||||
---are passed to the `entry` function and an optional `options` table may be
|
||||
---provided. Currently accepted `option` fields are `stack_size`.
|
||||
---
|
||||
---**Note** unsafe, please make sure the thread end of life before Lua state close.
|
||||
---
|
||||
---@generic T: uv.aliases.threadargs
|
||||
---@param options? {stack_size?: integer}
|
||||
---@param entry fun(...: T)|string
|
||||
---@vararg T # varargs passed to `entry`
|
||||
---@return luv_thread_t
|
||||
---@return luv_thread_t?, string? err_name, string? err_msg
|
||||
function uv.new_thread(options, entry, ...) end
|
||||
---@generic T: uv.aliases.threadargs
|
||||
---@param entry fun(...: T)|string
|
||||
---@vararg T # varargs passed to `entry`
|
||||
---@return luv_thread_t
|
||||
---@return luv_thread_t?, string? err_name, string? err_msg
|
||||
function uv.new_thread(entry, ...) end
|
||||
|
||||
-- TODO: make sure that the above method can indeed return nil + error.
|
||||
-- confirmed to not return error see luv/thread.c#luv_new_thread
|
||||
-- new_thread may fail if pthread fails.
|
||||
|
||||
---
|
||||
---Returns a boolean indicating whether two threads are the same. This function is
|
||||
@@ -3719,10 +3814,68 @@ function uv.new_thread(entry, ...) end
|
||||
function uv.thread_equal(thread, other_thread) end
|
||||
luv_thread_t.equal = uv.thread_equal
|
||||
|
||||
---
|
||||
---Sets the specified thread's affinity setting.
|
||||
---
|
||||
---`affinity` must be a table where each of the keys are a CPU number and the
|
||||
---values are booleans that represent whether the `thread` should be eligible to
|
||||
---run on that CPU. If the length of the `affinity` table is not greater than or
|
||||
---equal to `uv.cpumask_size()`, any CPU numbers missing from the table will have
|
||||
---their affinity set to `false`. If setting the affinity of more than
|
||||
---`uv.cpumask_size()` CPUs is desired, `affinity` must be an array-like table
|
||||
---with no gaps, since `#affinity` will be used as the `cpumask_size` if it is
|
||||
---greater than `uv.cpumask_size()`.
|
||||
---
|
||||
---If `get_old_affinity` is `true`, the previous affinity settings for the `thread`
|
||||
---will be returned. Otherwise, `true` is returned after a successful call.
|
||||
---
|
||||
---**Note:** Thread affinity setting is not atomic on Windows. Unsupported on macOS.
|
||||
---
|
||||
---@param thread luv_thread_t
|
||||
---@param affinity uv.aliases.thread_affinity
|
||||
---@param get_old_affinity? boolean
|
||||
---@return boolean|uv.aliases.thread_affinity|nil, string? err_name, string? err_msg
|
||||
function uv.thread_setaffinity(thread, affinity, get_old_affinity) end
|
||||
luv_thread_t.setaffinity = uv.thread_setaffinity
|
||||
|
||||
-- TODO: the above probably needs to use overloads for the different returns.
|
||||
-- TODO: the overload with the table return needs a @nodiscard.
|
||||
|
||||
---
|
||||
---Gets the specified thread's affinity setting.
|
||||
---
|
||||
---If `mask_size` is provided, it must be greater than or equal to
|
||||
---`uv.cpumask_size()`. If the `mask_size` parameter is omitted, then the return
|
||||
---of `uv.cpumask_size()` will be used. Returns an array-like table where each of
|
||||
---the keys correspond to a CPU number and the values are booleans that represent
|
||||
---whether the `thread` is eligible to run on that CPU.
|
||||
---
|
||||
---**Note:** Thread affinity getting is not atomic on Windows. Unsupported on macOS.
|
||||
---
|
||||
---@param thread luv_thread_t
|
||||
---@param mask_size? integer
|
||||
---@return table?, string? err_name, string? err_msg
|
||||
---@nodiscard
|
||||
function uv.thread_getaffinity(thread, mask_size) end
|
||||
luv_thread_t.getaffinity = uv.thread_getaffinity
|
||||
|
||||
---
|
||||
---Gets the CPU number on which the calling thread is running.
|
||||
---
|
||||
---**Note:** The first CPU will be returned as the number 1, not 0. This allows for
|
||||
---the number to correspond with the table keys used in `uv.thread_getaffinity` and
|
||||
---`uv.thread_setaffinity`.
|
||||
---
|
||||
---@return integer?, string? err_name, string? err_msg
|
||||
---@nodiscard
|
||||
function uv.thread_getcpu() end
|
||||
luv_thread_t.getcpu = uv.thread_getcpu
|
||||
|
||||
---
|
||||
---Returns the handle for the thread in which this is called.
|
||||
---
|
||||
---@return luv_thread_t
|
||||
---@nodiscard
|
||||
function uv.thread_self() end
|
||||
|
||||
---
|
||||
@@ -3739,6 +3892,8 @@ luv_thread_t.join = uv.thread_join
|
||||
---@param msec integer
|
||||
function uv.sleep(msec) end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---@section Miscellaneous utilities
|
||||
---@source misc.c
|
||||
@@ -3754,6 +3909,8 @@ function uv.sleep(msec) end
|
||||
|
||||
---@alias uv.aliases.interface_addresses {[string]: {ip: string, family: uv.aliases.network_family, netmask: string, internal: boolean, mac: string}}
|
||||
|
||||
---@alias uv.aliases.clock_gettime_rtn {sec: integer, nsec: integer}
|
||||
|
||||
---
|
||||
---Returns the executable path.
|
||||
---
|
||||
@@ -3813,6 +3970,16 @@ function uv.get_free_memory() end
|
||||
---@nodiscard
|
||||
function uv.get_constrained_memory() end
|
||||
|
||||
---
|
||||
---Gets the amount of free memory that is still available to the process (in
|
||||
---bytes). This differs from `uv.get_free_memory()` in that it takes into account
|
||||
---any limits imposed by the OS. If there is no such constraint, or the constraint
|
||||
---is unknown, the amount returned will be identical to `uv.get_free_memory()`.
|
||||
---
|
||||
---@return number
|
||||
---@nodiscard
|
||||
function uv.get_available_memory() end
|
||||
|
||||
---
|
||||
---Returns the resident set size (RSS) for the current process.
|
||||
---
|
||||
@@ -3848,6 +4015,14 @@ function uv.available_parallelism() end
|
||||
---@nodiscard
|
||||
function uv.cpu_info() end
|
||||
|
||||
---
|
||||
---Returns the maximum size of the mask used for process/thread affinities, or
|
||||
---`ENOTSUP` if affinities are not supported on the current platform.
|
||||
---
|
||||
---@return integer|nil, string? err_name, string? err_msg
|
||||
---@nodiscard
|
||||
function uv.cpumask_size() end
|
||||
|
||||
---
|
||||
---**Deprecated:** Please use `uv.os_getpid()` instead.
|
||||
---
|
||||
@@ -3900,6 +4075,21 @@ function uv.setgid(id) end
|
||||
---@nodiscard
|
||||
function uv.hrtime() end
|
||||
|
||||
---
|
||||
---Obtain the current system time from a high-resolution real-time or monotonic
|
||||
---clock source. `clock_id` can be the string `"monotonic"` or `"realtime"`.
|
||||
---
|
||||
---The real-time clock counts from the UNIX epoch (1970-01-01) and is subject
|
||||
---to time adjustments; it can jump back in time.
|
||||
---
|
||||
---The monotonic clock counts from an arbitrary point in the past and never
|
||||
---jumps back in time.
|
||||
---
|
||||
---@param clock_id string
|
||||
---@return uv.aliases.clock_gettime_rtn?, string? err_name, string? err_msg
|
||||
---@nodiscard
|
||||
function uv.clock_gettime(clock_id) end
|
||||
|
||||
---
|
||||
---Returns the current system uptime in seconds.
|
||||
---
|
||||
@@ -4124,11 +4314,15 @@ function uv.random(len, flags) end
|
||||
---@nodiscard
|
||||
function uv.translate_sys_error(errcode) end
|
||||
|
||||
|
||||
|
||||
---
|
||||
---@section Metrics operations
|
||||
---@source metrics.c
|
||||
---
|
||||
|
||||
---@alias uv.aliases.metric_info_rtn {loop_count: integer, events: integer, events_waiting: integer}
|
||||
|
||||
---
|
||||
---Retrieve the amount of time the event loop has been idle in the kernel’s event
|
||||
---provider (e.g. `epoll_wait`). The call is thread safe.
|
||||
@@ -4143,6 +4337,17 @@ function uv.translate_sys_error(errcode) end
|
||||
---@nodiscard
|
||||
function uv.metrics_idle_time() end
|
||||
|
||||
---
|
||||
---Get the metrics table from current set of event loop metrics. It is recommended
|
||||
---to retrieve these metrics in a `prepare` callback (see `uv.new_prepare`,
|
||||
---`uv.prepare_start`) in order to make sure there are no inconsistencies with the
|
||||
---metrics counters.
|
||||
---
|
||||
---@return uv.aliases.metric_info_rtn
|
||||
---@nodiscard
|
||||
function uv.metrics_info() end
|
||||
|
||||
|
||||
-- [[ constants ]]
|
||||
|
||||
-- TODO: make this its own section
|
||||
|
||||
Reference in New Issue
Block a user