Alien-uv
view release on metacpan or search on metacpan
libuv/docs/src/fs.rst view on Meta::CPAN
* ``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 `GetFinalPathNameByHandle <https://msdn.microsoft.com/en-us/library/windows/desktop/aa364962(v=vs.85).aspx>`_.
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:
libuv/docs/src/fs.rst view on Meta::CPAN
The file is created if it does not already exist.
.. c:macro:: UV_FS_O_DIRECT
File I/O is done directly to and from user-space buffers, which must be
aligned. Buffer size and address should be a multiple of the physical sector
size of the block device.
.. note::
`UV_FS_O_DIRECT` is supported on Linux, and on Windows via
`FILE_FLAG_NO_BUFFERING <https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
`UV_FS_O_DIRECT` is not supported on macOS.
.. c:macro:: UV_FS_O_DIRECTORY
If the path is not a directory, fail the open.
.. note::
`UV_FS_O_DIRECTORY` is not supported on Windows.
.. c:macro:: UV_FS_O_DSYNC
The file is opened for synchronous I/O. Write operations will complete once
all data and a minimum of metadata are flushed to disk.
.. note::
`UV_FS_O_DSYNC` is supported on Windows via
`FILE_FLAG_WRITE_THROUGH <https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
.. c:macro:: UV_FS_O_EXCL
If the `O_CREAT` flag is set and the file already exists, fail the open.
.. note::
In general, the behavior of `O_EXCL` is undefined if it is used without
`O_CREAT`. There is one exception: on Linux 2.6 and later, `O_EXCL` can
be used without `O_CREAT` if pathname refers to a block device. If the
block device is in use by the system (e.g., mounted), the open will fail
libuv/docs/src/fs.rst view on Meta::CPAN
.. note::
`UV_FS_O_NONBLOCK` is not supported on Windows.
.. c:macro:: UV_FS_O_RANDOM
Access is intended to be random. The system can use this as a hint to
optimize file caching.
.. note::
`UV_FS_O_RANDOM` is only supported on Windows via
`FILE_FLAG_RANDOM_ACCESS <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
.. c:macro:: UV_FS_O_RDONLY
Open the file for read-only access.
.. c:macro:: UV_FS_O_RDWR
Open the file for read-write access.
.. c:macro:: UV_FS_O_SEQUENTIAL
Access is intended to be sequential from beginning to end. The system can
use this as a hint to optimize file caching.
.. note::
`UV_FS_O_SEQUENTIAL` is only supported on Windows via
`FILE_FLAG_SEQUENTIAL_SCAN <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
.. c:macro:: UV_FS_O_SHORT_LIVED
The file is temporary and should not be flushed to disk if possible.
.. note::
`UV_FS_O_SHORT_LIVED` is only supported on Windows via
`FILE_ATTRIBUTE_TEMPORARY <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
.. c:macro:: UV_FS_O_SYMLINK
Open the symbolic link itself rather than the resource it points to.
.. c:macro:: UV_FS_O_SYNC
The file is opened for synchronous I/O. Write operations will complete once
all data and all metadata are flushed to disk.
.. note::
`UV_FS_O_SYNC` is supported on Windows via
`FILE_FLAG_WRITE_THROUGH <https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx>`_.
.. c:macro:: UV_FS_O_TEMPORARY
The file is temporary and should not be flushed to disk if possible.
.. note::
`UV_FS_O_TEMPORARY` is only supported on Windows via
`FILE_ATTRIBUTE_TEMPORARY <https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx>`_.
.. c:macro:: UV_FS_O_TRUNC
If the file exists and is a regular file, and the file is opened
successfully for write access, its length shall be truncated to zero.
.. c:macro:: UV_FS_O_WRONLY
Open the file for write-only access.
libuv/docs/src/guide/processes.rst view on Meta::CPAN
-----
libuv's ``uv_pipe_t`` structure is slightly confusing to Unix programmers,
because it immediately conjures up ``|`` and `pipe(7)`_. But ``uv_pipe_t`` is
not related to anonymous pipes, rather it is an IPC mechanism. ``uv_pipe_t``
can be backed by a `Unix Domain Socket`_ or `Windows Named Pipe`_ to allow
multiple processes to communicate. This is discussed below.
.. _pipe(7): http://www.kernel.org/doc/man-pages/online/pages/man7/pipe.7.html
.. _Unix Domain Socket: http://www.kernel.org/doc/man-pages/online/pages/man7/unix.7.html
.. _Windows Named Pipe: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365590(v=vs.85).aspx
Parent-child IPC
++++++++++++++++
A parent and child can have one or two way communication over a pipe created by
settings ``uv_stdio_container_t.flags`` to a bit-wise combination of
``UV_CREATE_PIPE`` and ``UV_READABLE_PIPE`` or ``UV_WRITABLE_PIPE``. The
read/write flag is from the perspective of the child process.
Arbitrary process IPC
+++++++++++++++++++++
Since domain sockets [#]_ can have a well known name and a location in the
file-system they can be used for IPC between unrelated processes. The D-BUS_
system used by open source desktop environments uses domain sockets for event
notification. Various applications can then react when a contact comes online
or new hardware is detected. The MySQL server also runs a domain socket on
which clients can interact with it.
.. _D-BUS: http://www.freedesktop.org/wiki/Software/dbus
When using domain sockets, a client-server pattern is usually followed with the
creator/owner of the socket acting as the server. After the initial setup,
messaging is no different from TCP, so we'll re-use the echo server example.
.. rubric:: pipe-echo-server/main.c
.. literalinclude:: ../../code/pipe-echo-server/main.c
:linenos:
:lines: 70-
:emphasize-lines: 5,10,14
( run in 0.334 second using v1.01-cache-2.11-cpan-299005ec8e3 )