aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-11-30 00:29:47 +0100
committerSantiago Gimeno <santiago.gimeno@gmail.com>2017-12-02 09:51:25 +0100
commit0d6525acae3b9cf8e52bda01a2662b82ca63f6dc (patch)
tree1f8fe02a14a1ea469b3a05bf248f071b42f63d85 /docs/src
parentc6b7e19f81ec10dfe56f8cb20d5793f428a20711 (diff)
downloadlibuv-0d6525acae3b9cf8e52bda01a2662b82ca63f6dc.tar.gz
libuv-0d6525acae3b9cf8e52bda01a2662b82ca63f6dc.zip
core: add getter/setter functions for easier ABI compat
Add getter/setter functions for the fields of public structs that might be relevant to e.g. Node.js addons. Through these methods, ABI compatibility for a subset of the ABI is easier to achieve, since using them makes code independent of the exact offsets of these fields. The intended use case that prompted this are N-API addons for Node.js, which look for more long-term ABI compatibility guarantees than typical Node code. With these helper functions, using libuv directly should no longer be an obstacle for such addons. PR-URL: https://github.com/libuv/libuv/pull/1657 Refs: https://github.com/nodejs/node/issues/13512 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/fs.rst30
-rw-r--r--docs/src/handle.rst32
-rw-r--r--docs/src/loop.rst12
-rw-r--r--docs/src/process.rst6
-rw-r--r--docs/src/request.rst27
-rw-r--r--docs/src/stream.rst6
-rw-r--r--docs/src/udp.rst12
7 files changed, 125 insertions, 0 deletions
diff --git a/docs/src/fs.rst b/docs/src/fs.rst
index 16d5e05c..87af828a 100644
--- a/docs/src/fs.rst
+++ b/docs/src/fs.rst
@@ -340,6 +340,36 @@ API
.. note::
These functions are not implemented on Windows.
+.. c:function:: uv_fs_type uv_fs_get_type(const uv_fs_t* req)
+
+ Returns `req->fs_type`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: ssize_t uv_fs_get_result(const uv_fs_t* req)
+
+ Returns `req->result`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: void* uv_fs_get_ptr(const uv_fs_t* req)
+
+ Returns `req->ptr`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: const char* uv_fs_get_path(const uv_fs_t* req)
+
+ Returns `req->path`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: uv_stat_t* uv_fs_get_statbuf(uv_fs_t* req)
+
+ Returns `&req->statbuf`.
+
+ .. versionadded:: 1.19.0
+
.. seealso:: The :c:type:`uv_req_t` API functions also apply.
Helper functions
diff --git a/docs/src/handle.rst b/docs/src/handle.rst
index a0f3d05f..e4cb90b5 100644
--- a/docs/src/handle.rst
+++ b/docs/src/handle.rst
@@ -211,6 +211,38 @@ just for some handle types.
Be very careful when using this function. libuv assumes it's in control of the file
descriptor so any change to it may lead to malfunction.
+.. c:function:: uv_loop_t* uv_handle_get_loop(const uv_handle_t* handle)
+
+ Returns `handle->loop`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: void* uv_handle_get_data(const uv_handle_t* handle)
+
+ Returns `handle->data`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: void* uv_handle_set_data(uv_handle_t* handle, void* data)
+
+ Sets `handle->data` to `data`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: uv_handle_type uv_handle_get_type(const uv_handle_t* handle)
+
+ Returns `handle->type`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: const char* uv_handle_type_name(uv_handle_type type)
+
+ Returns the name for the equivalent struct for a given handle type,
+ e.g. `"pipe"` (as in :c:type:`uv_pipe_t`) for `UV_NAMED_PIPE`.
+
+ If no such handle type exists, this returns `NULL`.
+
+ .. versionadded:: 1.19.0
.. _refcount:
diff --git a/docs/src/loop.rst b/docs/src/loop.rst
index 18dd135c..dcde5049 100644
--- a/docs/src/loop.rst
+++ b/docs/src/loop.rst
@@ -222,3 +222,15 @@ API
Any previous value returned from :c:func`uv_backend_fd` is now
invalid. That function must be called again to determine the
correct backend file descriptor.
+
+.. c:function:: void* uv_loop_get_data(const uv_loop_t* loop)
+
+ Returns `loop->data`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: void* uv_loop_set_data(uv_loop_t* loop, void* data)
+
+ Sets `loop->data` to `data`.
+
+ .. versionadded:: 1.19.0
diff --git a/docs/src/process.rst b/docs/src/process.rst
index b0380ddf..ecc3cbf3 100644
--- a/docs/src/process.rst
+++ b/docs/src/process.rst
@@ -222,4 +222,10 @@ API
Sends the specified signal to the given PID. Check the documentation
on :c:ref:`signal` for signal support, specially on Windows.
+.. c:function:: uv_pid_t uv_process_get_pid(const uv_process_t* handle)
+
+ Returns `handle->pid`.
+
+ .. versionadded:: 1.19.0
+
.. seealso:: The :c:type:`uv_handle_t` API functions also apply.
diff --git a/docs/src/request.rst b/docs/src/request.rst
index 660b80ae..54d9a2f3 100644
--- a/docs/src/request.rst
+++ b/docs/src/request.rst
@@ -80,3 +80,30 @@ API
Returns the size of the given request type. Useful for FFI binding writers
who don't want to know the structure layout.
+
+.. c:function:: void* uv_req_get_data(const uv_req_t* req)
+
+ Returns `req->data`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: void* uv_req_set_data(uv_req_t* req, void* data)
+
+ Sets `req->data` to `data`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: uv_req_type uv_req_get_type(const uv_req_t* req)
+
+ Returns `req->type`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: const char* uv_req_type_name(uv_req_type type)
+
+ Returns the name for the equivalent struct for a given request type,
+ e.g. `"connect"` (as in :c:type:`uv_connect_t`) for `UV_CONNECT`.
+
+ If no such request type exists, this returns `NULL`.
+
+ .. versionadded:: 1.19.0
diff --git a/docs/src/stream.rst b/docs/src/stream.rst
index 1f4e87e6..9ec23622 100644
--- a/docs/src/stream.rst
+++ b/docs/src/stream.rst
@@ -228,4 +228,10 @@ API
.. versionchanged:: 1.4.0 UNIX implementation added.
+.. c:function:: size_t uv_stream_get_write_queue_size(const uv_stream_t* stream)
+
+ Returns `stream->write_queue_size`.
+
+ .. versionadded:: 1.19.0
+
.. seealso:: The :c:type:`uv_handle_t` API functions also apply.
diff --git a/docs/src/udp.rst b/docs/src/udp.rst
index dd466033..8704a099 100644
--- a/docs/src/udp.rst
+++ b/docs/src/udp.rst
@@ -292,4 +292,16 @@ API
:returns: 0 on success, or an error code < 0 on failure.
+.. c:function:: size_t uv_udp_get_send_queue_size(const uv_udp_t* handle)
+
+ Returns `handle->send_queue_size`.
+
+ .. versionadded:: 1.19.0
+
+.. c:function:: size_t uv_udp_get_send_queue_count(const uv_udp_t* handle)
+
+ Returns `handle->send_queue_count`.
+
+ .. versionadded:: 1.19.0
+
.. seealso:: The :c:type:`uv_handle_t` API functions also apply.