diff options
author | Nhan Khong <knhana7@gmail.com> | 2019-06-27 20:14:09 +0700 |
---|---|---|
committer | Saúl Ibarra Corretgé <s@saghul.net> | 2019-09-25 14:39:23 +0200 |
commit | 75075d6cdbd79e83a27a3047cb7b86cbb5026aa0 (patch) | |
tree | 99763e0f2e5053ebea8946f81dab4023e2fa7a07 /docs/src | |
parent | 9b2c9b6c1f457be5015f6f651730c93c63c06fe7 (diff) | |
download | libuv-75075d6cdbd79e83a27a3047cb7b86cbb5026aa0.tar.gz libuv-75075d6cdbd79e83a27a3047cb7b86cbb5026aa0.zip |
docs: fix literal-includes in User Guide
Using raw copies in place of sphinx literalinclude
directives as the API of v1.x is now stable.
Fixes: https://github.com/libuv/libuv/issues/2350
PR-URL: https://github.com/libuv/libuv/pull/2353
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/guide/basics.rst | 35 | ||||
-rw-r--r-- | docs/src/guide/filesystem.rst | 51 | ||||
-rw-r--r-- | docs/src/guide/networking.rst | 5 | ||||
-rw-r--r-- | docs/src/guide/processes.rst | 12 | ||||
-rw-r--r-- | docs/src/guide/threads.rst | 10 |
5 files changed, 101 insertions, 12 deletions
diff --git a/docs/src/guide/basics.rst b/docs/src/guide/basics.rst index a0e41414..1da8d5ef 100644 --- a/docs/src/guide/basics.rst +++ b/docs/src/guide/basics.rst @@ -136,8 +136,39 @@ Handles are opaque structs named as ``uv_TYPE_t`` where type signifies what the handle is used for. .. rubric:: libuv watchers -.. literalinclude:: ../../../include/uv.h - :lines: 197-230 +.. code-block:: c + + /* Handle types. */ + typedef struct uv_loop_s uv_loop_t; + typedef struct uv_handle_s uv_handle_t; + typedef struct uv_dir_s uv_dir_t; + typedef struct uv_stream_s uv_stream_t; + typedef struct uv_tcp_s uv_tcp_t; + typedef struct uv_udp_s uv_udp_t; + typedef struct uv_pipe_s uv_pipe_t; + typedef struct uv_tty_s uv_tty_t; + typedef struct uv_poll_s uv_poll_t; + typedef struct uv_timer_s uv_timer_t; + typedef struct uv_prepare_s uv_prepare_t; + typedef struct uv_check_s uv_check_t; + typedef struct uv_idle_s uv_idle_t; + typedef struct uv_async_s uv_async_t; + typedef struct uv_process_s uv_process_t; + typedef struct uv_fs_event_s uv_fs_event_t; + typedef struct uv_fs_poll_s uv_fs_poll_t; + typedef struct uv_signal_s uv_signal_t; + + /* Request types. */ + typedef struct uv_req_s uv_req_t; + typedef struct uv_getaddrinfo_s uv_getaddrinfo_t; + typedef struct uv_getnameinfo_s uv_getnameinfo_t; + typedef struct uv_shutdown_s uv_shutdown_t; + typedef struct uv_write_s uv_write_t; + typedef struct uv_connect_s uv_connect_t; + typedef struct uv_udp_send_s uv_udp_send_t; + typedef struct uv_fs_s uv_fs_t; + typedef struct uv_work_s uv_work_t; + Handles represent long-lived objects. Async operations on such handles are identified using **requests**. A request is short-lived (usually used across diff --git a/docs/src/guide/filesystem.rst b/docs/src/guide/filesystem.rst index 6129303e..63dbbe47 100644 --- a/docs/src/guide/filesystem.rst +++ b/docs/src/guide/filesystem.rst @@ -118,8 +118,43 @@ same patterns as the read/write/open calls, returning the result in the ``uv_fs_t.result`` field. The full list: .. rubric:: Filesystem operations -.. literalinclude:: ../../../include/uv.h - :lines: 1084-1195 +.. code-block:: c + + int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb); + int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, int mode, uv_fs_cb cb); + int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb); + int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); + int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb); + int uv_fs_copyfile(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, int flags, uv_fs_cb cb); + int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb); + int uv_fs_mkdtemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, uv_fs_cb cb); + int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); + int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, uv_fs_cb cb); + int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent); + int uv_fs_opendir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); + int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, uv_dir_t* dir, uv_fs_cb cb); + int uv_fs_closedir(uv_loop_t* loop, uv_fs_t* req, uv_dir_t* dir, uv_fs_cb cb); + int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); + int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb); + int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb); + int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb); + int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb); + int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file, int64_t offset, uv_fs_cb cb); + int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd, int64_t in_offset, size_t length, uv_fs_cb cb); + int uv_fs_access(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb); + int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb); + int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, double mtime, uv_fs_cb cb); + int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime, double mtime, uv_fs_cb cb); + int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); + int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb); + 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); + int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); + int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); + int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file, int mode, uv_fs_cb cb); + 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); + 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); + 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); + .. _buffers-and-streams: @@ -254,8 +289,16 @@ The file change notification is started using ``uv_fs_event_init()``: The third argument is the actual file or directory to monitor. The last argument, ``flags``, can be: -.. literalinclude:: ../../../include/uv.h - :lines: 1299, 1308, 1315 +.. code-block:: c + + /* + * Flags to be passed to uv_fs_event_start(). + */ + enum uv_fs_event_flags { + UV_FS_EVENT_WATCH_ENTRY = 1, + UV_FS_EVENT_STAT = 2, + UV_FS_EVENT_RECURSIVE = 4 + }; ``UV_FS_EVENT_WATCH_ENTRY`` and ``UV_FS_EVENT_STAT`` don't do anything (yet). ``UV_FS_EVENT_RECURSIVE`` will start watching subdirectories as well on diff --git a/docs/src/guide/networking.rst b/docs/src/guide/networking.rst index 8d3c87bf..71119c0f 100644 --- a/docs/src/guide/networking.rst +++ b/docs/src/guide/networking.rst @@ -167,8 +167,9 @@ Multicast A socket can (un)subscribe to a multicast group using: -.. literalinclude:: ../../../include/uv.h - :lines: 594-597 +.. code::block:: c + + int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr, const char* interface_addr, uv_membership membership); where ``membership`` is ``UV_JOIN_GROUP`` or ``UV_LEAVE_GROUP``. diff --git a/docs/src/guide/processes.rst b/docs/src/guide/processes.rst index 19ce0572..ec3a7efc 100644 --- a/docs/src/guide/processes.rst +++ b/docs/src/guide/processes.rst @@ -181,8 +181,16 @@ The file descriptors of the child process are set using the ``stdio`` field in file descriptors being set. ``uv_process_options_t.stdio`` is an array of ``uv_stdio_container_t``, which is: -.. literalinclude:: ../../../include/uv.h - :lines: 826-834 +.. code-block:: c + + typedef struct uv_stdio_container_s { + uv_stdio_flags flags; + + union { + uv_stream_t* stream; + int fd; + } data; + } uv_stdio_container_t; where flags can have several values. Use ``UV_IGNORE`` if it isn't going to be used. If the first three ``stdio`` fields are marked as ``UV_IGNORE`` they'll diff --git a/docs/src/guide/threads.rst b/docs/src/guide/threads.rst index 960210db..1bec5e5a 100644 --- a/docs/src/guide/threads.rst +++ b/docs/src/guide/threads.rst @@ -76,8 +76,14 @@ Mutexes The mutex functions are a **direct** map to the pthread equivalents. .. rubric:: libuv mutex functions -.. literalinclude:: ../../../include/uv.h - :lines: 1575-1580 +.. code-block:: c + + int uv_mutex_init(uv_mutex_t* handle); + int uv_mutex_init_recursive(uv_mutex_t* handle); + void uv_mutex_destroy(uv_mutex_t* handle); + void uv_mutex_lock(uv_mutex_t* handle); + int uv_mutex_trylock(uv_mutex_t* handle); + void uv_mutex_unlock(uv_mutex_t* handle); The ``uv_mutex_init()``, ``uv_mutex_init_recursive()`` and ``uv_mutex_trylock()`` functions will return 0 on success, and an error code otherwise. |