summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/3rd/OpenResty/library/ngx.re.lua2
-rw-r--r--meta/3rd/OpenResty/library/ngx.ssl.lua11
-rw-r--r--meta/3rd/OpenResty/library/resty.shell.lua65
-rw-r--r--meta/3rd/OpenResty/library/resty.signal.lua69
-rw-r--r--meta/3rd/OpenResty/library/tablepool.lua4
5 files changed, 134 insertions, 17 deletions
diff --git a/meta/3rd/OpenResty/library/ngx.re.lua b/meta/3rd/OpenResty/library/ngx.re.lua
index 23055e45..826d9b3d 100644
--- a/meta/3rd/OpenResty/library/ngx.re.lua
+++ b/meta/3rd/OpenResty/library/ngx.re.lua
@@ -91,7 +91,7 @@ function re.opt(option, value) end
---
---@param subj string
---@param regex string
----@param opts ngx.re.options
+---@param opts? ngx.re.options
---@param ctx? ngx.re.ctx
---@param max? number
---@param res? string[]
diff --git a/meta/3rd/OpenResty/library/ngx.ssl.lua b/meta/3rd/OpenResty/library/ngx.ssl.lua
index 4e74e69e..42da031b 100644
--- a/meta/3rd/OpenResty/library/ngx.ssl.lua
+++ b/meta/3rd/OpenResty/library/ngx.ssl.lua
@@ -22,7 +22,7 @@ function ssl.set_der_priv_key(der_priv_key) end
--- This function can be called in any context.
---
---@param pem_priv_key string
----@return string? priv_key
+---@return ffi.cdata*? priv_key
---@return string? error
function ssl.parse_pem_priv_key(pem_priv_key) end
@@ -49,7 +49,7 @@ function ssl.get_tls1_version() end
---
--- Note that this set_cert function will run slightly faster, in terms of CPU cycles wasted, than the set_der_cert variant, since the first function uses opaque cdata pointers which do not require any additional conversion needed to be performed by the SSL library during the SSL handshake.
---
----@param cert_chain string
+---@param cert_chain ffi.cdata*
---@return boolean ok
---@return string? error
function ssl.set_cert(cert_chain) end
@@ -63,7 +63,7 @@ ssl.TLS1_VERSION=769
---
--- Note that this set_priv_key function will run slightly faster, in terms of CPU cycles wasted, than the set_der_priv_key variant, since the first function uses opaque cdata pointers which do not require any additional conversion needed to be performed by the SSL library during the SSL handshake.
---
----@param priv_key string
+---@param priv_key ffi.cdata*
---@return boolean ok
---@return string? error
function ssl.set_priv_key(priv_key) end
@@ -174,7 +174,8 @@ function ssl.raw_client_addr() end
---
--- This function can be called in any context.
---
----@return string? cert_chain
+---@param pem_cert_chain string
+---@return ffi.cdata*? cert_chain
---@return string? error
function ssl.parse_pem_cert(pem_cert_chain) end
@@ -276,7 +277,7 @@ function ssl.cert_pem_to_der(pem_cert_chain) end
---
--- This function was first added in version 0.1.20.
---
----@param ca_certs? any # the CA certificate chain opaque pointer returned by the parse_pem_cert function for the current SSL connection. The list of certificates will be sent to clients. Also, they will be added to trusted store. If omitted, will not send any CA certificate to clients.
+---@param ca_certs? ffi.cdata* # the CA certificate chain opaque pointer returned by the parse_pem_cert function for the current SSL connection. The list of certificates will be sent to clients. Also, they will be added to trusted store. If omitted, will not send any CA certificate to clients.
---@param depth? number verification depth in the client certificates chain. If omitted, will use the value specified by ssl_verify_depth.
---@return boolean ok
---@return string? error
diff --git a/meta/3rd/OpenResty/library/resty.shell.lua b/meta/3rd/OpenResty/library/resty.shell.lua
index 19f68464..be2d41ea 100644
--- a/meta/3rd/OpenResty/library/resty.shell.lua
+++ b/meta/3rd/OpenResty/library/resty.shell.lua
@@ -1,5 +1,62 @@
---@meta
-resty_shell={}
-function resty_shell.run(cmd, stdin, timeout, max_size) end
-resty_shell.version=0.01
-return resty_shell \ No newline at end of file
+
+local shell = {
+ version = 0.03,
+}
+
+
+--- Runs a shell command, `cmd`, with an optional stdin.
+---
+--- The `cmd` argument can either be a single string value (e.g. `"echo 'hello,
+--- world'"`) or an array-like Lua table (e.g. `{"echo", "hello, world"}`). The
+--- former is equivalent to `{"/bin/sh", "-c", "echo 'hello, world'"}`, but simpler
+--- and slightly faster.
+---
+--- When the `stdin` argument is `nil` or `""`, the stdin device will immediately
+--- be closed.
+---
+--- The `timeout` argument specifies the timeout threshold (in ms) for
+--- stderr/stdout reading timeout, stdin writing timeout, and process waiting
+--- timeout. The default is 10 seconds as per https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/pipe.md#set_timeouts
+---
+--- The `max_size` argument specifies the maximum size allowed for each output
+--- data stream of stdout and stderr. When exceeding the limit, the `run()`
+--- function will immediately stop reading any more data from the stream and return
+--- an error string in the `reason` return value: `"failed to read stdout: too much
+--- data"`.
+---
+--- Upon terminating successfully (with a zero exit status), `ok` will be `true`,
+--- `reason` will be `"exit"`, and `status` will hold the sub-process exit status.
+---
+--- Upon terminating abnormally (non-zero exit status), `ok` will be `false`,
+--- `reason` will be `"exit"`, and `status` will hold the sub-process exit status.
+---
+--- Upon exceeding a timeout threshold or any other unexpected error, `ok` will be
+--- `nil`, and `reason` will be a string describing the error.
+---
+--- When a timeout threshold is exceeded, the sub-process will be terminated as
+--- such:
+---
+--- 1. first, by receiving a `SIGTERM` signal from this library,
+--- 2. then, after 1ms, by receiving a `SIGKILL` signal from this library.
+---
+--- Note that child processes of the sub-process (if any) will not be terminated.
+--- You may need to terminate these processes yourself.
+---
+--- When the sub-process is terminated by a UNIX signal, the `reason` return value
+--- will be `"signal"` and the `status` return value will hold the signal number.
+---
+---@param cmd string|string[]
+---@param stdin? string
+---@param timeout? number
+---@param max_size? number
+---
+---@return boolean ok
+---@return string? stdout
+---@return string? stderr
+---@return string|'"exit"'|'"signal"' reason
+---@return number? status
+function shell.run(cmd, stdin, timeout, max_size) end
+
+
+return shell \ No newline at end of file
diff --git a/meta/3rd/OpenResty/library/resty.signal.lua b/meta/3rd/OpenResty/library/resty.signal.lua
index 05000561..912b2f00 100644
--- a/meta/3rd/OpenResty/library/resty.signal.lua
+++ b/meta/3rd/OpenResty/library/resty.signal.lua
@@ -1,6 +1,65 @@
---@meta
-resty_signal={}
-function resty_signal.kill(pid, sig) end
-function resty_signal.signum(name) end
-resty_signal.version=0.02
-return resty_signal \ No newline at end of file
+
+local signal = {
+ version = 0.03,
+}
+
+---@alias resty.signal.name
+---| '"HUP"'
+---| '"INT"'
+---| '"QUIT"'
+---| '"ILL"'
+---| '"TRAP"'
+---| '"ABRT"'
+---| '"BUS"'
+---| '"FPE"'
+---| '"KILL"'
+---| '"USR1"'
+---| '"SEGV"'
+---| '"USR2"'
+---| '"PIPE"'
+---| '"ALRM"'
+---| '"TERM"'
+---| '"CHLD"'
+---| '"CONT"'
+---| '"STOP"'
+---| '"TSTP"'
+---| '"TTIN"'
+---| '"TTOU"'
+---| '"URG"'
+---| '"XCPU"'
+---| '"XFSZ"'
+---| '"VTALRM"'
+---| '"PROF"'
+---| '"WINCH"'
+---| '"IO"'
+---| '"PWR"'
+---| '"EMT"'
+---| '"SYS"'
+---| '"INFO"'
+---| '"NONE"' # The special signal name NONE is also supported, which is mapped to zero (0).
+
+
+---
+-- Sends a signal with its name string or number value to the process of the specified pid.
+--
+-- All signal names accepted by signum are supported, like HUP, KILL, and TERM.
+--
+-- Signal numbers are also supported when specifying nonportable system-specific signals is desired.
+--
+---@param pid number
+---@param signal_name_or_num number|resty.signal.name
+---
+---@return boolean ok
+---@return string? error
+function signal.kill(pid, signal_name_or_num) end
+
+---
+-- Maps the signal name specified to the system-specific signal number.
+-- Returns `nil` if the signal name is not known.
+--
+---@param name resty.signal.name
+---@return number|nil
+function signal.signum(name) end
+
+return signal \ No newline at end of file
diff --git a/meta/3rd/OpenResty/library/tablepool.lua b/meta/3rd/OpenResty/library/tablepool.lua
index 056d2716..db47f3e7 100644
--- a/meta/3rd/OpenResty/library/tablepool.lua
+++ b/meta/3rd/OpenResty/library/tablepool.lua
@@ -1,5 +1,5 @@
---@meta
-local tablepool={}
+local tablepool = {}
--- Releases the already used Lua table, `tb`, into the table pool named `pool_name`. If the specified table pool does not exist, create it right away.
---
@@ -13,7 +13,7 @@ local tablepool={}
---
---@param pool_name string
---@param tb table
----@param no_clear boolean
+---@param no_clear? boolean
function tablepool.release(pool_name, tb, no_clear) end
--- Fetches a (free) Lua table from the table pool of the specified name `pool_name`.