aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2016-03-01 15:41:01 -0500
committercjihrig <cjihrig@gmail.com>2016-03-29 08:13:59 -0400
commit217f81b6a18f52322ddfdaf704e9057005e3d10d (patch)
treed8fc8034045d11af99cb554d641c971ed17c7336 /docs/src
parent27aa81fe5a19940d2f39f902c1bede814d49bbb6 (diff)
downloadlibuv-217f81b6a18f52322ddfdaf704e9057005e3d10d.tar.gz
libuv-217f81b6a18f52322ddfdaf704e9057005e3d10d.zip
unix,win: add uv_get_passwd()
This commit adds the uv_get_passwd() function, which returns a subset of the current effective user's password file entry. Refs: https://github.com/libuv/libuv/issues/11 Fixes: https://github.com/libuv/libuv/issues/731 PR-URL: https://github.com/libuv/libuv/pull/742 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/misc.rst32
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/src/misc.rst b/docs/src/misc.rst
index ebcb75a2..f32af48f 100644
--- a/docs/src/misc.rst
+++ b/docs/src/misc.rst
@@ -122,6 +122,20 @@ Data types
} netmask;
} uv_interface_address_t;
+.. c:type:: uv_passwd_t
+
+ Data type for password file information.
+
+ ::
+
+ typedef struct uv_passwd_s {
+ char* username;
+ long uid;
+ long gid;
+ char* shell;
+ char* homedir;
+ } uv_passwd_t;
+
API
---
@@ -291,6 +305,24 @@ API
.. versionadded:: 1.9.0
+.. c:function:: int uv_os_get_passwd(uv_passwd_t* pwd)
+
+ Gets a subset of the password file entry for the current effective uid (not
+ the real uid). The populated data includes the username, euid, gid, shell,
+ and home directory. On non-Windows systems, all data comes from
+ :man:`getpwuid_r(3)`. On Windows, uid and gid are set to -1 and have no
+ meaning, and shell is `NULL`. After successfully calling this function, the
+ memory allocated to `pwd` needs to be freed with
+ :c:func:`uv_os_free_passwd`.
+
+ .. versionadded:: 1.9.0
+
+.. c:function:: void uv_os_free_passwd(uv_passwd_t* pwd)
+
+ Frees the `pwd` memory previously allocated with :c:func:`uv_os_get_passwd`.
+
+ .. versionadded:: 1.9.0
+
.. uint64_t uv_get_free_memory(void)
.. c:function:: uint64_t uv_get_total_memory(void)