When the supplied buffer is not big enough and UV_ENOBUFS is
returned, hint the user about the required size by setting
the len paramemeter to the required value.
Applies to:
- uv_pipe_getsockname
- uv_fs_event_getpath
- uv_fs_poll_getpath
EAI_NODATA and some other getaddrinfo() error codes are returned by
glibc but not exposed in the headers unless _GNU_SOURCE is defined.
Only define in src/uv-common.c because that's the only file that deals
with EAI_* error codes.
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.
Fixes#684.
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.
Fixes#684.
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.
Fixes#684.
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.
Fixes#684.
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.
Fixes#684.
uv_ip6_addr() copies the address part to a temporary buffer when it
contains a link-local suffix ('<address>%<interface>'). Before this
commit, it didn't zero-terminate the address properly: it put the nul
byte at the end of the temporary buffer rather than at the end of the
address string, meaning the buffer looked like this:
<address> <garbage> '\0'
Fixes the following valgrind warning:
==16170== Conditional jump or move depends on uninitialised value(s)
==16170== at 0x43602C: inet_pton6 (inet.c:228)
==16170== by 0x435CE1: uv_inet_pton (inet.c:163)
==16170== by 0x436FD0: uv_ip6_addr (uv-common.c:175)
==16170== by 0x434717: test_ip6_addr_scope (test-ip6-addr.c:89)
==16170== by 0x43455B: call_iface_info_cb (test-ip6-addr.c:45)
==16170== by 0x43462B: foreach_ip6_interface (test-ip6-addr.c:59)
==16170== by 0x434791: run_test_ip6_addr_link_local (test-ip6-add
==16170== by 0x4061E8: run_test_part (runner.c:396)
==16170== by 0x404F4B: main (run-tests.c:58)
==16170==
==16170== Conditional jump or move depends on uninitialised value(s)
==16170== at 0x4C2AD8A: __GI_strchr (mc_replace_strmem.c:224)
==16170== by 0x435ECB: inet_pton6 (inet.c:231)
==16170== by 0x435CE1: uv_inet_pton (inet.c:163)
==16170== by 0x436FD0: uv_ip6_addr (uv-common.c:175)
==16170== by 0x434717: test_ip6_addr_scope (test-ip6-addr.c:89)
==16170== by 0x43455B: call_iface_info_cb (test-ip6-addr.c:45)
==16170== by 0x43462B: foreach_ip6_interface (test-ip6-addr.c:59)
==16170== by 0x434791: run_test_ip6_addr_link_local (test-ip6-add
==16170== by 0x4061E8: run_test_part (runner.c:396)
==16170== by 0x404F4B: main (run-tests.c:58)
Fixes#890.
Fixes the following warning:
src\uv-common.c(476): warning C4715:
'uv__getaddrinfo_translate_error' : not all control paths return
a value
The function never returns - the final statement is a call to abort() -
but it seems MSVC's program flow analyzer is too weak to figure that
out.
This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.
A code snippet like this one:
if (uv_foo(loop) < 0) {
uv_err_t err = uv_last_error(loop);
fprintf(stderr, "%s\n", uv_strerror(err));
}
Should be rewritten like this:
int err = uv_foo(loop);
if (err < 0)
fprintf(stderr, "%s\n", uv_strerror(err));
The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.
This commit changes how the event loop determines if it needs to stay alive.
Previously, an internal counter was increased whenever a handle got created
and decreased again when the handle was closed.
While conceptually simple, it turned out hard to work with: you often want
to keep the event loop alive only if the handle is actually doing something.
Stopped or inactive handles were a frequent source of hanging event loops.
That's why this commit changes the reference counting scheme to a model where
a handle only references the event loop when it's active. 'Active' means
different things for different handle types, e.g.:
* timers: ticking
* sockets: reading, writing or listening
* processes: always active (for now, subject to change)
* idle, check, prepare: only active when started
This commit also changes how the uv_ref() and uv_unref() functions work: they
now operate on the level of individual handles, not the whole event loop.
The Windows implementation was done by Bert Belder.