XS-libuv

 view release on metacpan or  search on metacpan

libuv-1.49.2/docs/src/misc.rst  view on Meta::CPAN


    To get an interface identifier in a cross-platform compatible way,
    use `uv_if_indextoiid()`.

    Example:

    ::

        char ifname[UV_IF_NAMESIZE];
        size_t size = sizeof(ifname);
        uv_if_indextoname(sin6->sin6_scope_id, ifname, &size);

    .. versionadded:: 1.16.0

.. c:function:: int uv_if_indextoiid(unsigned int ifindex, char* buffer, size_t* size)

    Retrieves a network interface identifier suitable for use in an IPv6 scoped
    address. On Windows, returns the numeric `ifindex` as a string. On all other
    platforms, `uv_if_indextoname()` is called. The result is written to
    `buffer`, with `*size` indicating the length of `buffer`. If `buffer` is not
    large enough to hold the result, then `UV_ENOBUFS` is returned, and `*size`
    represents the size, including the NUL byte, required to hold the
    result.

    See `uv_if_indextoname` for further details.

    .. versionadded:: 1.16.0

.. c:function:: int uv_exepath(char* buffer, size_t* size)

    Gets the executable path. You *must* call `uv_setup_args` before calling
    this function.

.. c:function:: int uv_cwd(char* buffer, size_t* size)

    Gets the current working directory, and stores it in `buffer`. If the
    current working directory is too large to fit in `buffer`, this function
    returns `UV_ENOBUFS`, and sets `size` to the required length, including the
    null terminator.

    .. versionchanged:: 1.1.0

        On Unix the path no longer ends in a slash.

    .. versionchanged:: 1.9.0 the returned length includes the terminating null
                        byte on `UV_ENOBUFS`, and the buffer is null terminated
                        on success.


.. c:function:: int uv_chdir(const char* dir)

    Changes the current working directory.

.. c:function:: int uv_os_homedir(char* buffer, size_t* size)

    Gets the current user's home directory. On Windows, `uv_os_homedir()` first
    checks the `USERPROFILE` environment variable using
    `GetEnvironmentVariableW()`. If `USERPROFILE` is not set,
    `GetUserProfileDirectoryW()` is called. On all other operating systems,
    `uv_os_homedir()` first checks the `HOME` environment variable using
    :man:`getenv(3)`. If `HOME` is not set, :man:`getpwuid_r(3)` is called. The
    user's home directory is stored in `buffer`. When `uv_os_homedir()` is
    called, `size` indicates the maximum size of `buffer`. On success `size` is set
    to the string length of `buffer`. On `UV_ENOBUFS` failure `size` is set to the
    required length for `buffer`, including the null byte.

    .. warning::
        `uv_os_homedir()` is not thread safe.

    .. versionadded:: 1.6.0

.. c:function:: int uv_os_tmpdir(char* buffer, size_t* size)

    Gets the temp directory. On Windows, `uv_os_tmpdir()` uses `GetTempPathW()`.
    On all other operating systems, `uv_os_tmpdir()` uses the first environment
    variable found in the ordered list `TMPDIR`, `TMP`, `TEMP`, and `TEMPDIR`.
    If none of these are found, the path `"/tmp"` is used, or, on Android,
    `"/data/local/tmp"` is used. The temp directory is stored in `buffer`. When
    `uv_os_tmpdir()` is called, `size` indicates the maximum size of `buffer`.
    On success `size` is set to the string length of `buffer` (which does not
    include the terminating null). On `UV_ENOBUFS` failure `size` is set to the
    required length for `buffer`, including the null byte.

    .. warning::
        `uv_os_tmpdir()` is not thread safe.

    .. 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:: int uv_os_get_passwd2(uv_passwd_t* pwd, uv_uid_t uid)

    Gets a subset of the password file entry for the provided 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.45.0

.. c:function:: int uv_os_get_group(uv_group_t* group, uv_uid_t gid)

    Gets a subset of the group file entry for the provided uid.
    The populated data includes the group name, gid, and members. On non-Windows
    systems, all data comes from :man:`getgrgid_r(3)`. On Windows, uid and gid
    are set to -1 and have no meaning. After successfully calling this function,
    the memory allocated to `group` needs to be freed with
    :c:func:`uv_os_free_group`.

    .. versionadded:: 1.45.0

.. c:function:: void uv_os_free_group(uv_passwd_t* pwd)

    Frees the memory previously allocated with :c:func:`uv_os_get_group`.

    .. versionadded:: 1.45.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

.. c:function:: uint64_t uv_get_free_memory(void)

    Gets the amount of free memory available in the system, as reported by
    the kernel (in bytes). Returns 0 when unknown.

.. c:function:: uint64_t uv_get_total_memory(void)

    Gets the total amount of physical memory in the system (in bytes).
    Returns 0 when unknown.

.. c:function:: uint64_t uv_get_constrained_memory(void)

    Gets the total amount of memory available to the process (in bytes) based on
    limits imposed by the OS. If there is no such constraint, or the constraint
    is unknown, `0` is returned. If there is a constraining mechanism, but there
    is no constraint set, `UINT64_MAX` is returned. Note that it is not unusual
    for this value to be less than or greater than :c:func:`uv_get_total_memory`.

    .. note::
        This function currently only returns a non-zero value on Linux, based
        on cgroups if it is present, and on z/OS based on RLIMIT_MEMLIMIT.

    .. versionadded:: 1.29.0

.. c:function:: uint64_t uv_get_available_memory(void)

    Gets the amount of free memory that is still available to the process (in bytes).
    This differs from :c:func:`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 :c:func:`uv_get_free_memory`.



( run in 2.522 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )