Blame README.md

Packit b5b901
![libuv][libuv_banner]
Packit b5b901
Packit b5b901
## Overview
Packit b5b901
Packit b5b901
libuv is a multi-platform support library with a focus on asynchronous I/O. It
Packit b5b901
was primarily developed for use by [Node.js][], but it's also
Packit b5b901
used by [Luvit](http://luvit.io/), [Julia](http://julialang.org/),
Packit b5b901
[pyuv](https://github.com/saghul/pyuv), and [others](https://github.com/libuv/libuv/wiki/Projects-that-use-libuv).
Packit b5b901
Packit b5b901
## Feature highlights
Packit b5b901
Packit b5b901
 * Full-featured event loop backed by epoll, kqueue, IOCP, event ports.
Packit b5b901
Packit b5b901
 * Asynchronous TCP and UDP sockets
Packit b5b901
Packit b5b901
 * Asynchronous DNS resolution
Packit b5b901
Packit b5b901
 * Asynchronous file and file system operations
Packit b5b901
Packit b5b901
 * File system events
Packit b5b901
Packit b5b901
 * ANSI escape code controlled TTY
Packit b5b901
Packit b5b901
 * IPC with socket sharing, using Unix domain sockets or named pipes (Windows)
Packit b5b901
Packit b5b901
 * Child processes
Packit b5b901
Packit b5b901
 * Thread pool
Packit b5b901
Packit b5b901
 * Signal handling
Packit b5b901
Packit b5b901
 * High resolution clock
Packit b5b901
Packit b5b901
 * Threading and synchronization primitives
Packit b5b901
Packit b5b901
## Versioning
Packit b5b901
Packit b5b901
Starting with version 1.0.0 libuv follows the [semantic versioning](http://semver.org/)
Packit b5b901
scheme. The API change and backwards compatibility rules are those indicated by
Packit b5b901
SemVer. libuv will keep a stable ABI across major releases.
Packit b5b901
Packit b5b901
The ABI/API changes can be tracked [here](http://abi-laboratory.pro/tracker/timeline/libuv/).
Packit b5b901
Packit b5b901
## Licensing
Packit b5b901
Packit b5b901
libuv is licensed under the MIT license. Check the [LICENSE file](LICENSE).
Packit b5b901
The documentation is licensed under the CC BY 4.0 license. Check the [LICENSE-docs file](LICENSE-docs).
Packit b5b901
Packit b5b901
## Community
Packit b5b901
Packit b5b901
 * [Support](https://github.com/libuv/help)
Packit b5b901
 * [Mailing list](http://groups.google.com/group/libuv)
Packit b5b901
 * [IRC chatroom (#libuv@irc.freenode.org)](http://webchat.freenode.net?channels=libuv&uio=d4)
Packit b5b901
Packit b5b901
## Documentation
Packit b5b901
Packit b5b901
### Official documentation
Packit b5b901
Packit b5b901
Located in the docs/ subdirectory. It uses the [Sphinx](http://sphinx-doc.org/)
Packit b5b901
framework, which makes it possible to build the documentation in multiple
Packit b5b901
formats.
Packit b5b901
Packit b5b901
Show different supported building options:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ make help
Packit b5b901
```
Packit b5b901
Packit b5b901
Build documentation as HTML:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ make html
Packit b5b901
```
Packit b5b901
Packit b5b901
Build documentation as HTML and live reload it when it changes (this requires
Packit b5b901
sphinx-autobuild to be installed and is only supported on Unix):
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ make livehtml
Packit b5b901
```
Packit b5b901
Packit b5b901
Build documentation as man pages:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ make man
Packit b5b901
```
Packit b5b901
Packit b5b901
Build documentation as ePub:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ make epub
Packit b5b901
```
Packit b5b901
Packit b5b901
NOTE: Windows users need to use make.bat instead of plain 'make'.
Packit b5b901
Packit b5b901
Documentation can be browsed online [here](http://docs.libuv.org).
Packit b5b901
Packit b5b901
The [tests and benchmarks](https://github.com/libuv/libuv/tree/master/test)
Packit b5b901
also serve as API specification and usage examples.
Packit b5b901
Packit b5b901
### Other resources
Packit b5b901
Packit b5b901
 * [LXJS 2012 talk](http://www.youtube.com/watch?v=nGn60vDSxQ4)
Packit b5b901
   — High-level introductory talk about libuv.
Packit b5b901
 * [libuv-dox](https://github.com/thlorenz/libuv-dox)
Packit b5b901
   — Documenting types and methods of libuv, mostly by reading uv.h.
Packit b5b901
 * [learnuv](https://github.com/thlorenz/learnuv)
Packit b5b901
   — Learn uv for fun and profit, a self guided workshop to libuv.
Packit b5b901
Packit b5b901
These resources are not handled by libuv maintainers and might be out of
Packit b5b901
date. Please verify it before opening new issues.
Packit b5b901
Packit b5b901
## Downloading
Packit b5b901
Packit b5b901
libuv can be downloaded either from the
Packit b5b901
[GitHub repository](https://github.com/libuv/libuv)
Packit b5b901
or from the [downloads site](http://dist.libuv.org/dist/).
Packit b5b901
Packit b5b901
Before verifying the git tags or signature files, importing the relevant keys
Packit b5b901
is necessary. Key IDs are listed in the
Packit b5b901
[MAINTAINERS](https://github.com/libuv/libuv/blob/master/MAINTAINERS.md)
Packit b5b901
file, but are also available as git blob objects for easier use.
Packit b5b901
Packit b5b901
Importing a key the usual way:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ gpg --keyserver pool.sks-keyservers.net --recv-keys AE9BC059
Packit b5b901
```
Packit b5b901
Packit b5b901
Importing a key from a git blob object:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ git show pubkey-saghul | gpg --import
Packit b5b901
```
Packit b5b901
Packit b5b901
### Verifying releases
Packit b5b901
Packit b5b901
Git tags are signed with the developer's key, they can be verified as follows:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ git verify-tag v1.6.1
Packit b5b901
```
Packit b5b901
Packit b5b901
Starting with libuv 1.7.0, the tarballs stored in the
Packit b5b901
[downloads site](http://dist.libuv.org/dist/) are signed and an accompanying
Packit b5b901
signature file sit alongside each. Once both the release tarball and the
Packit b5b901
signature file are downloaded, the file can be verified as follows:
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ gpg --verify libuv-1.7.0.tar.gz.sign
Packit b5b901
```
Packit b5b901
Packit b5b901
## Build Instructions
Packit b5b901
Packit Service e08953
For UNIX-like platforms, including macOS, there are two build methods:
Packit Service e08953
autotools or [CMake][].
Packit b5b901
Packit Service e08953
For Windows, [CMake][] is the only supported build method and has the
Packit Service e08953
following prerequisites:
Packit b5b901
Packit Service e08953
<details>
Packit b5b901
Packit b5b901
* One of:
Packit b5b901
  * [Visual C++ Build Tools][]
Packit b5b901
  * [Visual Studio 2015 Update 3][], all editions
Packit b5b901
    including the Community edition (remember to select
Packit b5b901
    "Common Tools for Visual C++ 2015" feature during installation).
Packit b5b901
  * [Visual Studio 2017][], any edition (including the Build Tools SKU).
Packit b5b901
    **Required Components:** "MSbuild", "VC++ 2017 v141 toolset" and one of the
Packit b5b901
    Windows SDKs (10 or 8.1).
Packit b5b901
* Basic Unix tools required for some tests,
Packit b5b901
  [Git for Windows][] includes Git Bash
Packit b5b901
  and tools which can be included in the global `PATH`.
Packit b5b901
Packit Service e08953
</details>
Packit b5b901
Packit Service e08953
To build with autotools:
Packit b5b901
Packit b5b901
```bash
Packit Service e08953
$ sh autogen.sh
Packit Service e08953
$ ./configure
Packit Service e08953
$ make
Packit Service e08953
$ make check
Packit Service e08953
$ make install
Packit b5b901
```
Packit b5b901
Packit Service e08953
To build with [CMake][]:
Packit b5b901
Packit b5b901
```bash
Packit Service e08953
$ mkdir -p build
Packit b5b901
Packit Service e08953
$ (cd build && cmake .. -DBUILD_TESTING=ON) # generate project with tests
Packit Service e08953
$ cmake --build build                       # add `-j <n>` with cmake >= 3.12
Packit b5b901
Packit Service e08953
# Run tests:
Packit Service e08953
$ (cd build && ctest -C Debug --output-on-failure)
Packit b5b901
Packit Service e08953
# Or manually run tests:
Packit Service e08953
$ build/uv_run_tests                        # shared library build
Packit Service e08953
$ build/uv_run_tests_a                      # static library build
Packit Service e08953
```
Packit Service e08953
Packit Service e08953
To cross-compile with [CMake][] (unsupported but generally works):
Packit b5b901
Packit b5b901
```bash
Packit Service e08953
$ cmake ../..                 \
Packit Service e08953
  -DCMAKE_SYSTEM_NAME=Windows \
Packit Service e08953
  -DCMAKE_SYSTEM_VERSION=6.1  \
Packit Service e08953
  -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc
Packit b5b901
```
Packit b5b901
Packit Service e08953
### Install with Homebrew
Packit b5b901
Packit b5b901
```bash
Packit b5b901
$ brew install --HEAD libuv
Packit b5b901
```
Packit b5b901
Packit b5b901
Note to OS X users:
Packit b5b901
Packit b5b901
Make sure that you specify the architecture you wish to build for in the
Packit b5b901
"ARCHS" flag. You can specify more than one by delimiting with a space
Packit b5b901
(e.g. "x86_64 i386").
Packit b5b901
Packit b5b901
### Running tests
Packit b5b901
Packit Service e08953
Some tests are timing sensitive. Relaxing test timeouts may be necessary
Packit Service e08953
on slow or overloaded machines:
Packit b5b901
Packit b5b901
```bash
Packit Service e08953
$ env UV_TEST_TIMEOUT_MULTIPLIER=2 build/uv_run_tests # 10s instead of 5s
Packit b5b901
```
Packit b5b901
Packit b5b901
#### Run one test
Packit b5b901
Packit b5b901
The list of all tests is in `test/test-list.h`.
Packit b5b901
Packit Service e08953
This invocation will cause the test driver to fork and execute `TEST_NAME` in
Packit Service e08953
a child process:
Packit b5b901
Packit b5b901
```bash
Packit Service e08953
$ build/uv_run_tests_a TEST_NAME
Packit b5b901
```
Packit b5b901
Packit Service e08953
This invocation will cause the test driver to execute the test in
Packit Service e08953
the same process:
Packit b5b901
Packit b5b901
```bash
Packit Service e08953
$ build/uv_run_tests_a TEST_NAME TEST_NAME
Packit b5b901
```
Packit b5b901
Packit b5b901
#### Debugging tools
Packit b5b901
Packit Service e08953
When running the test from within the test driver process
Packit Service e08953
(`build/uv_run_tests_a TEST_NAME TEST_NAME`), tools like gdb and valgrind
Packit Service e08953
work normally.
Packit Service e08953
Packit Service e08953
When running the test from a child of the test driver process
Packit Service e08953
(`build/uv_run_tests_a TEST_NAME`), use these tools in a fork-aware manner.
Packit b5b901
Packit b5b901
##### Fork-aware gdb
Packit b5b901
Packit b5b901
Use the [follow-fork-mode](https://sourceware.org/gdb/onlinedocs/gdb/Forks.html) setting:
Packit b5b901
Packit b5b901
```
Packit Service e08953
$ gdb --args build/uv_run_tests_a TEST_NAME
Packit b5b901
Packit b5b901
(gdb) set follow-fork-mode child
Packit b5b901
...
Packit b5b901
```
Packit b5b901
Packit b5b901
##### Fork-aware valgrind
Packit b5b901
Packit b5b901
Use the `--trace-children=yes` parameter:
Packit b5b901
Packit b5b901
```bash
Packit Service e08953
$ valgrind --trace-children=yes -v --tool=memcheck --leak-check=full --track-origins=yes --leak-resolution=high --show-reachable=yes --log-file=memcheck-%p.log build/uv_run_tests_a TEST_NAME
Packit b5b901
```
Packit b5b901
Packit b5b901
### Running benchmarks
Packit b5b901
Packit b5b901
See the section on running tests.
Packit Service e08953
The benchmark driver is `./uv_run_benchmarks_a` and the benchmarks are
Packit Service e08953
listed in `test/benchmark-list.h`.
Packit b5b901
Packit b5b901
## Supported Platforms
Packit b5b901
Packit b5b901
Check the [SUPPORTED_PLATFORMS file](SUPPORTED_PLATFORMS.md).
Packit b5b901
Packit b5b901
### AIX Notes
Packit b5b901
Packit Service e08953
AIX compilation using IBM XL C/C++ requires version 12.1 or greater.
Packit Service e08953
Packit b5b901
AIX support for filesystem events requires the non-default IBM `bos.ahafs`
Packit b5b901
package to be installed.  This package provides the AIX Event Infrastructure
Packit b5b901
that is detected by `autoconf`.
Packit b5b901
[IBM documentation](http://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/)
Packit b5b901
describes the package in more detail.
Packit b5b901
Packit b5b901
### z/OS Notes
Packit b5b901
Packit b5b901
z/OS creates System V semaphores and message queues. These persist on the system
Packit b5b901
after the process terminates unless the event loop is closed.
Packit b5b901
Packit b5b901
Use the `ipcrm` command to manually clear up System V resources.
Packit b5b901
Packit b5b901
## Patches
Packit b5b901
Packit b5b901
See the [guidelines for contributing][].
Packit b5b901
Packit Service e08953
[CMake]: https://cmake.org/
Packit b5b901
[node.js]: http://nodejs.org/
Packit b5b901
[guidelines for contributing]: https://github.com/libuv/libuv/blob/master/CONTRIBUTING.md
Packit b5b901
[libuv_banner]: https://raw.githubusercontent.com/libuv/libuv/master/img/banner.png
Packit b5b901
[Visual C++ Build Tools]: https://visualstudio.microsoft.com/visual-cpp-build-tools/
Packit b5b901
[Visual Studio 2015 Update 3]: https://www.visualstudio.com/vs/older-downloads/
Packit b5b901
[Visual Studio 2017]: https://www.visualstudio.com/downloads/
Packit b5b901
[Git for Windows]: http://git-scm.com/download/win