bitmap: use unsigned int for iterating over bitmap words

Bitmap words (e.g. resulting from BITMAP_{N,HEAD}WORDS) are of
unsigned type.

Use "unsigned int" to iterate over bitmap words to avoid comparisons
between signed and unsigned expressions. GCC otherwise warns about
these when -Wsign-compare is enabled.

Signed-off-by: Emilio G. Cota <cota@braap.org>
io: io_never for events that should never happen.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
io: change io_idle() to io_wait()

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
io: don't close if already closing in io_close_other.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
net: fix ipv4 immediate connect
ccan/bitmap: const for bitmap_test_bit.

No reason for it not to be.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
bitmap: Use const qualifiers where possible

A number of functions in bitmap.h take parameters which they don't modify
but aren't currently marked as const.  This patch fixes that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
net: don't return still-connecting fd.

If one connect failed, we'd return the other one without
waiting for the connect to complete.  This resulted in
read() returning 0, which was really weird.

The downside: the poll doesn't seem to time out when the
connect times out (Linux 3.13 x86-64).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
test: add test to ensure we can use non-const lists via check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/ccanlint: don't assert on relative directories for -d.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
io: correctly list ccan/typesafe_cb as dependency.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
antithread: correctly list ccan/typesafe_cb as dependency.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/ccanlint: detect more unmentioned dependencies.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
container_of: work with -Wcast-qual

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
cpuid: fix LICENSE file to be symlink.

Somehow, it was a normal file.

Reported-by: Sam Watkins <sam@nipl.net>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
minmax: New module, safe min and max macros

Add a 'minmax' module with typesafe macros to compute minimum, maximum and
clamping.  Inspired by the versions used in the Linux kernel, but using
a different implementation based on __builtin_types_compatible_p() and the
build_assert module.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
jacobson_karels: New module

A straightforward implementation of the Jacobson/Karels algorithm for
estimating round-trip time on a network link.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
idtree: use ccan/tal instead of talloc

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tal: fix tal_check description

Cut & paste bug.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tal/link: remove incorrect references to talloc

Showing its origins in talloc_link.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>