forked from cory/tildefriends
libuv 1.42.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3650 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2
deps/libuv/docs/src/guide/basics.rst
vendored
2
deps/libuv/docs/src/guide/basics.rst
vendored
@ -87,6 +87,7 @@ nothing, except start a loop which will exit immediately.
|
||||
|
||||
.. rubric:: helloworld/main.c
|
||||
.. literalinclude:: ../../code/helloworld/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
|
||||
This program quits immediately because it has no events to process. A libuv
|
||||
@ -202,6 +203,7 @@ event watchers are active.
|
||||
|
||||
.. rubric:: idle-basic/main.c
|
||||
.. literalinclude:: ../../code/idle-basic/main.c
|
||||
:language: c
|
||||
:emphasize-lines: 6,10,14-17
|
||||
|
||||
Storing context
|
||||
|
2
deps/libuv/docs/src/guide/eventloops.rst
vendored
2
deps/libuv/docs/src/guide/eventloops.rst
vendored
@ -20,6 +20,7 @@ these things can be a bit difficult to understand, so let's look at
|
||||
|
||||
.. rubric:: src/unix/core.c - uv_run
|
||||
.. literalinclude:: ../../../src/unix/core.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 304-324
|
||||
:emphasize-lines: 10,19,21
|
||||
@ -43,6 +44,7 @@ iteration of the loop still takes places.
|
||||
|
||||
.. rubric:: uvstop/main.c
|
||||
.. literalinclude:: ../../code/uvstop/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:emphasize-lines: 11
|
||||
|
||||
|
9
deps/libuv/docs/src/guide/filesystem.rst
vendored
9
deps/libuv/docs/src/guide/filesystem.rst
vendored
@ -54,6 +54,7 @@ a callback for when the file is opened:
|
||||
|
||||
.. rubric:: uvcat/main.c - opening a file
|
||||
.. literalinclude:: ../../code/uvcat/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 41-53
|
||||
:emphasize-lines: 4, 6-7
|
||||
@ -63,6 +64,7 @@ The ``result`` field of a ``uv_fs_t`` is the file descriptor in case of the
|
||||
|
||||
.. rubric:: uvcat/main.c - read callback
|
||||
.. literalinclude:: ../../code/uvcat/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 26-40
|
||||
:emphasize-lines: 2,8,12
|
||||
@ -87,6 +89,7 @@ callbacks.
|
||||
|
||||
.. rubric:: uvcat/main.c - write callback
|
||||
.. literalinclude:: ../../code/uvcat/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 16-24
|
||||
:emphasize-lines: 6
|
||||
@ -100,6 +103,7 @@ We set the dominos rolling in ``main()``:
|
||||
|
||||
.. rubric:: uvcat/main.c
|
||||
.. literalinclude:: ../../code/uvcat/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 55-
|
||||
:emphasize-lines: 2
|
||||
@ -203,6 +207,7 @@ opened as bidirectional by default.
|
||||
|
||||
.. rubric:: uvtee/main.c - read on pipes
|
||||
.. literalinclude:: ../../code/uvtee/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 61-80
|
||||
:emphasize-lines: 4,5,15
|
||||
@ -218,6 +223,7 @@ these buffers.
|
||||
|
||||
.. rubric:: uvtee/main.c - reading buffers
|
||||
.. literalinclude:: ../../code/uvtee/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 19-22,44-60
|
||||
|
||||
@ -242,6 +248,7 @@ point there is nothing to be read. Most applications will just ignore this.
|
||||
|
||||
.. rubric:: uvtee/main.c - Write to pipe
|
||||
.. literalinclude:: ../../code/uvtee/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 9-13,23-42
|
||||
|
||||
@ -282,6 +289,7 @@ The file change notification is started using ``uv_fs_event_init()``:
|
||||
|
||||
.. rubric:: onchange/main.c - The setup
|
||||
.. literalinclude:: ../../code/onchange/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 26-
|
||||
:emphasize-lines: 15
|
||||
@ -320,6 +328,7 @@ In our example we simply print the arguments and run the command using
|
||||
|
||||
.. rubric:: onchange/main.c - file change notification callback
|
||||
.. literalinclude:: ../../code/onchange/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 9-24
|
||||
|
||||
|
2
deps/libuv/docs/src/guide/introduction.rst
vendored
2
deps/libuv/docs/src/guide/introduction.rst
vendored
@ -72,4 +72,4 @@ There is no need to ``make install``. To build the examples run ``make`` in the
|
||||
.. _node.js: https://www.nodejs.org
|
||||
.. _libev was removed: https://github.com/joyent/libuv/issues/485
|
||||
.. _Rust: https://www.rust-lang.org
|
||||
.. _variety: https://github.com/libuv/libuv/wiki/Projects-that-use-libuv
|
||||
.. _variety: https://github.com/libuv/libuv/blob/v1.x/LINKS.md
|
||||
|
9
deps/libuv/docs/src/guide/networking.rst
vendored
9
deps/libuv/docs/src/guide/networking.rst
vendored
@ -38,6 +38,7 @@ Here is a simple echo server
|
||||
|
||||
.. rubric:: tcp-echo-server/main.c - The listen socket
|
||||
.. literalinclude:: ../../code/tcp-echo-server/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 68-
|
||||
:emphasize-lines: 4-5,7-10
|
||||
@ -60,6 +61,7 @@ In this case we also establish interest in reading from this stream.
|
||||
|
||||
.. rubric:: tcp-echo-server/main.c - Accepting the client
|
||||
.. literalinclude:: ../../code/tcp-echo-server/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 51-66
|
||||
:emphasize-lines: 9-10
|
||||
@ -108,6 +110,7 @@ address from a `DHCP`_ server -- DHCP Discover.
|
||||
|
||||
.. rubric:: udp-dhcp/main.c - Setup and send UDP packets
|
||||
.. literalinclude:: ../../code/udp-dhcp/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 7-11,104-
|
||||
:emphasize-lines: 8,10-11,17-18,21
|
||||
@ -143,6 +146,7 @@ the OS will discard the data that could not fit* (That's UDP for you!).
|
||||
|
||||
.. rubric:: udp-dhcp/main.c - Reading packets
|
||||
.. literalinclude:: ../../code/udp-dhcp/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 17-40
|
||||
:emphasize-lines: 1,23
|
||||
@ -189,10 +193,11 @@ Querying DNS
|
||||
libuv provides asynchronous DNS resolution. For this it provides its own
|
||||
``getaddrinfo`` replacement [#]_. In the callback you can
|
||||
perform normal socket operations on the retrieved addresses. Let's connect to
|
||||
Freenode to see an example of DNS resolution.
|
||||
Libera.chat to see an example of DNS resolution.
|
||||
|
||||
.. rubric:: dns/main.c
|
||||
.. literalinclude:: ../../code/dns/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 61-
|
||||
:emphasize-lines: 12
|
||||
@ -209,6 +214,7 @@ call ``uv_freeaddrinfo`` in the callback.
|
||||
|
||||
.. rubric:: dns/main.c
|
||||
.. literalinclude:: ../../code/dns/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 42-60
|
||||
:emphasize-lines: 8,16
|
||||
@ -227,6 +233,7 @@ useful to allow your service to bind to IP addresses when it starts.
|
||||
|
||||
.. rubric:: interfaces/main.c
|
||||
.. literalinclude:: ../../code/interfaces/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:emphasize-lines: 9,17
|
||||
|
||||
|
15
deps/libuv/docs/src/guide/processes.rst
vendored
15
deps/libuv/docs/src/guide/processes.rst
vendored
@ -27,6 +27,7 @@ exits. This is achieved using ``uv_spawn``.
|
||||
|
||||
.. rubric:: spawn/main.c
|
||||
.. literalinclude:: ../../code/spawn/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 6-8,15-
|
||||
:emphasize-lines: 11,13-17
|
||||
@ -54,6 +55,7 @@ which caused the exit.
|
||||
|
||||
.. rubric:: spawn/main.c
|
||||
.. literalinclude:: ../../code/spawn/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 9-12
|
||||
:emphasize-lines: 3
|
||||
@ -104,6 +106,7 @@ does not affect it.
|
||||
|
||||
.. rubric:: detach/main.c
|
||||
.. literalinclude:: ../../code/detach/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 9-30
|
||||
:emphasize-lines: 12,19
|
||||
@ -140,6 +143,7 @@ stop watching. Here is a small example demonstrating the various possibilities:
|
||||
|
||||
.. rubric:: signal/main.c
|
||||
.. literalinclude:: ../../code/signal/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:emphasize-lines: 17-18,27-28
|
||||
|
||||
@ -172,6 +176,7 @@ which is:
|
||||
|
||||
.. rubric:: proc-streams/test.c
|
||||
.. literalinclude:: ../../code/proc-streams/test.c
|
||||
:language: c
|
||||
|
||||
The actual program ``proc-streams`` runs this while sharing only ``stderr``.
|
||||
The file descriptors of the child process are set using the ``stdio`` field in
|
||||
@ -199,6 +204,7 @@ Then we set the ``fd`` to ``stderr``.
|
||||
|
||||
.. rubric:: proc-streams/main.c
|
||||
.. literalinclude:: ../../code/proc-streams/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 15-17,27-
|
||||
:emphasize-lines: 6,10,11,12
|
||||
@ -217,12 +223,14 @@ A sample CGI script/executable is:
|
||||
|
||||
.. rubric:: cgi/tick.c
|
||||
.. literalinclude:: ../../code/cgi/tick.c
|
||||
:language: c
|
||||
|
||||
The CGI server combines the concepts from this chapter and :doc:`networking` so
|
||||
that every client is sent ten ticks after which that connection is closed.
|
||||
|
||||
.. rubric:: cgi/main.c
|
||||
.. literalinclude:: ../../code/cgi/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 49-63
|
||||
:emphasize-lines: 10
|
||||
@ -232,6 +240,7 @@ Here we simply accept the TCP connection and pass on the socket (*stream*) to
|
||||
|
||||
.. rubric:: cgi/main.c
|
||||
.. literalinclude:: ../../code/cgi/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 16, 25-45
|
||||
:emphasize-lines: 8-9,18,20
|
||||
@ -291,6 +300,7 @@ 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
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 70-
|
||||
:emphasize-lines: 5,10,14
|
||||
@ -330,6 +340,7 @@ it by the master.
|
||||
|
||||
.. rubric:: multi-echo-server/worker.c
|
||||
.. literalinclude:: ../../code/multi-echo-server/worker.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 7-9,81-
|
||||
:emphasize-lines: 6-8
|
||||
@ -343,6 +354,7 @@ standard input of the worker, we connect the pipe to ``stdin`` using
|
||||
|
||||
.. rubric:: multi-echo-server/worker.c
|
||||
.. literalinclude:: ../../code/multi-echo-server/worker.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 51-79
|
||||
:emphasize-lines: 10,15,20
|
||||
@ -361,6 +373,7 @@ allow load balancing.
|
||||
|
||||
.. rubric:: multi-echo-server/main.c
|
||||
.. literalinclude:: ../../code/multi-echo-server/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 9-13
|
||||
|
||||
@ -369,6 +382,7 @@ master and the individual process.
|
||||
|
||||
.. rubric:: multi-echo-server/main.c
|
||||
.. literalinclude:: ../../code/multi-echo-server/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 51,61-95
|
||||
:emphasize-lines: 17,20-21
|
||||
@ -387,6 +401,7 @@ worker in the round-robin.
|
||||
|
||||
.. rubric:: multi-echo-server/main.c
|
||||
.. literalinclude:: ../../code/multi-echo-server/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 31-49
|
||||
:emphasize-lines: 9,12-13
|
||||
|
12
deps/libuv/docs/src/guide/threads.rst
vendored
12
deps/libuv/docs/src/guide/threads.rst
vendored
@ -39,6 +39,7 @@ wait for it to close using ``uv_thread_join()``.
|
||||
|
||||
.. rubric:: thread-create/main.c
|
||||
.. literalinclude:: ../../code/thread-create/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 26-36
|
||||
:emphasize-lines: 3-7
|
||||
@ -55,6 +56,7 @@ thread, scheduled pre-emptively by the operating system:
|
||||
|
||||
.. rubric:: thread-create/main.c
|
||||
.. literalinclude:: ../../code/thread-create/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 6-14
|
||||
:emphasize-lines: 2
|
||||
@ -124,6 +126,7 @@ example.
|
||||
|
||||
.. rubric:: locks/main.c - simple rwlocks
|
||||
.. literalinclude:: ../../code/locks/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:emphasize-lines: 13,16,27,31,42,55
|
||||
|
||||
@ -208,6 +211,7 @@ event loop from performing other activities.
|
||||
|
||||
.. rubric:: queue-work/main.c - lazy fibonacci
|
||||
.. literalinclude:: ../../code/queue-work/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 17-29
|
||||
|
||||
@ -221,6 +225,7 @@ The trigger is ``uv_queue_work``:
|
||||
|
||||
.. rubric:: queue-work/main.c
|
||||
.. literalinclude:: ../../code/queue-work/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 31-44
|
||||
:emphasize-lines: 10
|
||||
@ -248,6 +253,7 @@ up a signal handler for termination.
|
||||
|
||||
.. rubric:: queue-cancel/main.c
|
||||
.. literalinclude:: ../../code/queue-cancel/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 43-
|
||||
|
||||
@ -256,6 +262,7 @@ When the user triggers the signal by pressing ``Ctrl+C`` we send
|
||||
|
||||
.. rubric:: queue-cancel/main.c
|
||||
.. literalinclude:: ../../code/queue-cancel/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 33-41
|
||||
:emphasize-lines: 6
|
||||
@ -265,6 +272,7 @@ with ``status`` set to ``UV_ECANCELED``.
|
||||
|
||||
.. rubric:: queue-cancel/main.c
|
||||
.. literalinclude:: ../../code/queue-cancel/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 28-31
|
||||
:emphasize-lines: 2
|
||||
@ -292,6 +300,7 @@ informing the user of the status of running downloads.
|
||||
|
||||
.. rubric:: progress/main.c
|
||||
.. literalinclude:: ../../code/progress/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 7-8,35-
|
||||
:emphasize-lines: 2,11
|
||||
@ -317,6 +326,7 @@ with the async watcher whenever it receives a message.
|
||||
|
||||
.. rubric:: progress/main.c
|
||||
.. literalinclude:: ../../code/progress/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 10-24
|
||||
:emphasize-lines: 7-8
|
||||
@ -327,6 +337,7 @@ non-blocking and will return immediately.
|
||||
|
||||
.. rubric:: progress/main.c
|
||||
.. literalinclude:: ../../code/progress/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 31-34
|
||||
|
||||
@ -336,6 +347,7 @@ Finally it is important to remember to clean up the watcher.
|
||||
|
||||
.. rubric:: progress/main.c
|
||||
.. literalinclude:: ../../code/progress/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 26-29
|
||||
:emphasize-lines: 3
|
||||
|
13
deps/libuv/docs/src/guide/utilities.rst
vendored
13
deps/libuv/docs/src/guide/utilities.rst
vendored
@ -87,6 +87,7 @@ JS object and can be ref/unrefed.
|
||||
|
||||
.. rubric:: ref-timer/main.c
|
||||
.. literalinclude:: ../../code/ref-timer/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 5-8, 17-
|
||||
:emphasize-lines: 9
|
||||
@ -111,6 +112,7 @@ idle watcher to keep the UI operational.
|
||||
|
||||
.. rubric:: idle-compute/main.c
|
||||
.. literalinclude:: ../../code/idle-compute/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 5-9, 34-
|
||||
:emphasize-lines: 13
|
||||
@ -123,6 +125,7 @@ keep calling the idle callback again.
|
||||
|
||||
.. rubric:: idle-compute/main.c
|
||||
.. literalinclude:: ../../code/idle-compute/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 10-19
|
||||
|
||||
@ -215,6 +218,7 @@ progress with the download whenever libuv notifies of I/O readiness.
|
||||
|
||||
.. rubric:: uvwget/main.c - The setup
|
||||
.. literalinclude:: ../../code/uvwget/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 1-9,140-
|
||||
:emphasize-lines: 7,21,24-25
|
||||
@ -235,6 +239,7 @@ So we add each argument as an URL
|
||||
|
||||
.. rubric:: uvwget/main.c - Adding urls
|
||||
.. literalinclude:: ../../code/uvwget/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 39-56
|
||||
:emphasize-lines: 13-14
|
||||
@ -251,6 +256,7 @@ on sockets whenever ``handle_socket`` is called.
|
||||
|
||||
.. rubric:: uvwget/main.c - Setting up polling
|
||||
.. literalinclude:: ../../code/uvwget/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 102-140
|
||||
:emphasize-lines: 9,11,15,21,24
|
||||
@ -271,6 +277,7 @@ mask with the new value. ``curl_perform`` is the crux of this program.
|
||||
|
||||
.. rubric:: uvwget/main.c - Driving libcurl.
|
||||
.. literalinclude:: ../../code/uvwget/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 81-95
|
||||
:emphasize-lines: 2,6-7,12
|
||||
@ -288,6 +295,7 @@ transfers are done.
|
||||
|
||||
.. rubric:: uvwget/main.c - Reading transfer status.
|
||||
.. literalinclude:: ../../code/uvwget/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 58-79
|
||||
:emphasize-lines: 6,9-10,13-14
|
||||
@ -312,6 +320,7 @@ Let us first look at the interface provided to plugin authors.
|
||||
|
||||
.. rubric:: plugin/plugin.h
|
||||
.. literalinclude:: ../../code/plugin/plugin.h
|
||||
:language: c
|
||||
:linenos:
|
||||
|
||||
You can similarly add more functions that plugin authors can use to do useful
|
||||
@ -319,6 +328,7 @@ things in your application [#]_. A sample plugin using this API is:
|
||||
|
||||
.. rubric:: plugin/hello.c
|
||||
.. literalinclude:: ../../code/plugin/hello.c
|
||||
:language: c
|
||||
:linenos:
|
||||
|
||||
Our interface defines that all plugins should have an ``initialize`` function
|
||||
@ -340,6 +350,7 @@ This is done by using ``uv_dlopen`` to first load the shared library
|
||||
|
||||
.. rubric:: plugin/main.c
|
||||
.. literalinclude:: ../../code/plugin/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:lines: 7-
|
||||
:emphasize-lines: 15, 18, 24
|
||||
@ -393,6 +404,7 @@ Here is a simple example which prints white text on a red background:
|
||||
|
||||
.. rubric:: tty/main.c
|
||||
.. literalinclude:: ../../code/tty/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:emphasize-lines: 11-12,14,17,27
|
||||
|
||||
@ -403,6 +415,7 @@ escape codes.
|
||||
|
||||
.. rubric:: tty-gravity/main.c
|
||||
.. literalinclude:: ../../code/tty-gravity/main.c
|
||||
:language: c
|
||||
:linenos:
|
||||
:emphasize-lines: 19,25,38
|
||||
|
||||
|
Reference in New Issue
Block a user