aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2020-05-15 23:07:01 -0700
committercjihrig <cjihrig@gmail.com>2020-08-09 11:52:22 -0400
commit07e4168b67f6d06dac2c2e21c9a1976a0db9d312 (patch)
tree301ba075eefb79f80045839eeaafc0c2832a3a57 /docs/src
parent278cfa018356c29b24b8be6a25dbefba84b406d3 (diff)
downloadlibuv-07e4168b67f6d06dac2c2e21c9a1976a0db9d312.tar.gz
libuv-07e4168b67f6d06dac2c2e21c9a1976a0db9d312.zip
unix: error when uv_setup_args() is not called
This commit updates uv_{get,set}_process_title() to return an error when uv_setup_args() is needed, but has not been called. Per-platform behavior after this commit: - Windows: uv_setup_args() does nothing, get/set process title works as before. - Unix: get/set process title will return ENOBUFS if uv_setup_args() wasn't called, if it failed, or if the process title memory has been freed by uv__process_title_cleanup() (via uv_library_shutdown()). - AIX: set process title returns ENOBUFS if uv_setup_args() wasn't called, if it failed to allocate memory for the argv copy, or if the proctitle memory has been freed by uv__process_title_cleanup() (via uv_library_shutdown). Getting the process title will do the same except it can still succeed if uv_setup_args() was called but failed to allocate memory for the argv copy. - BSD: uv_setup_args() is only needed for getting the initial process title; if uv_setup_args() is not called then any get_process_title calls() before a set_process_title() call will return an empty string. - Platforms that use no-proctitle.c: get will return an empty string, set is a no-op (these are the same as before this commit) Fixes: https://github.com/libuv/libuv/issues/2845 PR-URL: https://github.com/libuv/libuv/pull/2853 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/misc.rst29
1 files changed, 22 insertions, 7 deletions
diff --git a/docs/src/misc.rst b/docs/src/misc.rst
index 96f8b8ce..d765962e 100644
--- a/docs/src/misc.rst
+++ b/docs/src/misc.rst
@@ -275,22 +275,37 @@ API
.. c:function:: int uv_get_process_title(char* buffer, size_t size)
Gets the title of the current process. You *must* call `uv_setup_args`
- before calling this function. If `buffer` is `NULL` or `size` is zero,
- `UV_EINVAL` is returned. If `size` cannot accommodate the process title and
- terminating `NULL` character, the function returns `UV_ENOBUFS`.
+ before calling this function on Unix and AIX systems. If `uv_setup_args`
+ has not been called on systems that require it, then `UV_ENOBUFS` is
+ returned. If `buffer` is `NULL` or `size` is zero, `UV_EINVAL` is returned.
+ If `size` cannot accommodate the process title and terminating `nul`
+ character, the function returns `UV_ENOBUFS`.
+
+ .. note::
+ On BSD systems, `uv_setup_args` is needed for getting the initial process
+ title. The process title returned will be an empty string until either
+ `uv_setup_args` or `uv_set_process_title` is called.
.. versionchanged:: 1.18.1 now thread-safe on all supported platforms.
+ .. versionchanged:: 1.39.0 now returns an error if `uv_setup_args` is needed
+ but hasn't been called.
+
.. c:function:: int uv_set_process_title(const char* title)
Sets the current process title. You *must* call `uv_setup_args` before
- calling this function. On platforms with a fixed size buffer for the process
- title the contents of `title` will be copied to the buffer and truncated if
- larger than the available space. Other platforms will return `UV_ENOMEM` if
- they cannot allocate enough space to duplicate the contents of `title`.
+ calling this function on Unix and AIX systems. If `uv_setup_args` has not
+ been called on systems that require it, then `UV_ENOBUFS` is returned. On
+ platforms with a fixed size buffer for the process title the contents of
+ `title` will be copied to the buffer and truncated if larger than the
+ available space. Other platforms will return `UV_ENOMEM` if they cannot
+ allocate enough space to duplicate the contents of `title`.
.. versionchanged:: 1.18.1 now thread-safe on all supported platforms.
+ .. versionchanged:: 1.39.0 now returns an error if `uv_setup_args` is needed
+ but hasn't been called.
+
.. c:function:: int uv_resident_set_memory(size_t* rss)
Gets the resident set size (RSS) for the current process.