XS-libuv
view release on metacpan or search on metacpan
libuv-1.49.2/docs/src/fs.rst view on Meta::CPAN
Equivalent to :man:`utime(2)`, :man:`futimes(3)` and :man:`lutimes(3)` respectively.
.. note::
z/OS: `uv_fs_lutime()` is not implemented for z/OS. It can still be called but will return
``UV_ENOSYS``.
.. note::
AIX: `uv_fs_futime()` and `uv_fs_lutime()` functions only work for AIX 7.1 and newer.
They can still be called on older versions but will return ``UV_ENOSYS``.
.. versionchanged:: 1.10.0 sub-second precission is supported on Windows
.. c:function:: int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb)
Equivalent to :man:`link(2)`.
.. c:function:: int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, int flags, uv_fs_cb cb)
Equivalent to :man:`symlink(2)`.
.. note::
On Windows the `flags` parameter can be specified to control how the symlink will
be created:
* ``UV_FS_SYMLINK_DIR``: indicates that `path` points to a directory.
* ``UV_FS_SYMLINK_JUNCTION``: request that the symlink is created
using junction points.
.. c:function:: int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
Equivalent to :man:`readlink(2)`.
The resulting string is stored in `req->ptr`.
.. c:function:: int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
Equivalent to :man:`realpath(3)` on Unix. Windows uses `GetFinalPathNameByHandleW <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew>`_.
The resulting string is stored in `req->ptr`.
.. warning::
This function has certain platform-specific caveats that were discovered when used in Node.
* macOS and other BSDs: this function will fail with UV_ELOOP if more than 32 symlinks are
found while resolving the given path. This limit is hardcoded and cannot be sidestepped.
* Windows: while this function works in the common case, there are a number of corner cases
where it doesn't:
- Paths in ramdisk volumes created by tools which sidestep the Volume Manager (such as ImDisk)
cannot be resolved.
- Inconsistent casing when using drive letters.
- Resolved path bypasses subst'd drives.
While this function can still be used, it's not recommended if scenarios such as the
above need to be supported.
The background story and some more details on these issues can be checked
`here <https://github.com/nodejs/node/issues/7726>`_.
.. versionadded:: 1.8.0
.. c:function:: int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb)
.. c:function:: int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb)
.. c:function:: int uv_fs_lchown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb)
Equivalent to :man:`chown(2)`, :man:`fchown(2)` and :man:`lchown(2)` respectively.
.. note::
These functions are not implemented on Windows.
.. versionchanged:: 1.21.0 implemented uv_fs_lchown
.. 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:: int uv_fs_get_system_error(const uv_fs_t* req)
Returns the platform specific error code - `GetLastError()` value on Windows
and `-(req->result)` on other platforms.
.. versionadded:: 1.38.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
----------------
.. c:function:: uv_os_fd_t uv_get_osfhandle(int fd)
For a file descriptor in the C runtime, get the OS-dependent handle.
On UNIX, returns the ``fd`` intact. On Windows, this calls `_get_osfhandle <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=vs-2019>`_.
Note that the return value is still owned by the C runtime,
any attempts to close it or to use it after closing the fd may lead to malfunction.
.. versionadded:: 1.12.0
.. c:function:: int uv_open_osfhandle(uv_os_fd_t os_fd)
For a OS-dependent handle, get the file descriptor in the C runtime.
On UNIX, returns the ``os_fd`` intact. On Windows, this calls `_open_osfhandle <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-osfhandle?view=vs-2019>`_.
Note that this consumes the argument, any attempts to close it or to use it
after closing the return value may lead to malfunction.
.. versionadded:: 1.23.0
( run in 0.608 second using v1.01-cache-2.11-cpan-5511b514fd6 )