]> git.ozlabs.org Git - ccan/log
ccan
9 years agohtable: update tools for time changes.
Rusty Russell [Tue, 10 Jun 2014 06:02:30 +0000 (15:32 +0930)]
htable: update tools for time changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotime: time_mono() helpers.
Rusty Russell [Wed, 4 Jun 2014 03:43:19 +0000 (13:13 +0930)]
time: time_mono() helpers.

From patch by David Gibson, rewritten on new ccan/time.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agoio failtest timer tools: fallout from time changes.
Rusty Russell [Tue, 3 Jun 2014 10:39:04 +0000 (20:09 +0930)]
io failtest timer tools: fallout from time changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotime: split absolute and relative times.
Rusty Russell [Tue, 3 Jun 2014 03:56:13 +0000 (13:26 +0930)]
time: split absolute and relative times.

As suggested by David Gibson.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotal/talloc: include all ccan dependencies.
Rusty Russell [Tue, 10 Jun 2014 05:09:34 +0000 (14:39 +0930)]
tal/talloc: include all ccan dependencies.

ccanlint now detects more missing dependencies.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotal/talloc: fix overflow on 64 bit systems
Rusty Russell [Tue, 10 Jun 2014 05:09:34 +0000 (14:39 +0930)]
tal/talloc: fix overflow on 64 bit systems

Arguably a bug in talloc_realloc_array, which uses an unsigned for
size, resulting in silent truncation and a memcpy into a too-small
buffer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agostr_talloc: delete.
Rusty Russell [Tue, 10 Jun 2014 05:09:34 +0000 (14:39 +0930)]
str_talloc: delete.

All the cool kids are using tal/str now...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agograb_file: don't use str_talloc for tests.
Rusty Russell [Tue, 10 Jun 2014 05:09:26 +0000 (14:39 +0930)]
grab_file: don't use str_talloc for tests.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agohtable: tools: use tal instead of talloc.
Rusty Russell [Tue, 10 Jun 2014 05:04:46 +0000 (14:34 +0930)]
htable: tools: use tal instead of talloc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotools: use tal/grab_file
Rusty Russell [Tue, 10 Jun 2014 03:36:16 +0000 (13:06 +0930)]
tools: use tal/grab_file

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agostrset: use tal instead of talloc in examples and tools.
Rusty Russell [Tue, 10 Jun 2014 03:36:16 +0000 (13:06 +0930)]
strset: use tal instead of talloc in examples and tools.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agostrset: update tools for new ABI
Rusty Russell [Tue, 10 Jun 2014 03:36:16 +0000 (13:06 +0930)]
strset: update tools for new ABI

Broken since commit 7c69053bd418bf0abd21f29e8cb11164684310ca
which normalized API.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agostrset: update ccan/time usage in tools
Rusty Russell [Tue, 10 Jun 2014 03:36:16 +0000 (13:06 +0930)]
strset: update ccan/time usage in tools

Broken since commit 2012d45e273c3016dbd09b2606efc9ffab07c57f
which switched to timespec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agocrcsync: use tal/grab_file in _info example.
Rusty Russell [Tue, 10 Jun 2014 03:36:16 +0000 (13:06 +0930)]
crcsync: use tal/grab_file in _info example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotal/grab_file: new module
Rusty Russell [Tue, 10 Jun 2014 03:36:12 +0000 (13:06 +0930)]
tal/grab_file: new module

tal variant of grab_file (which uses talloc).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotalloc_link: remove it.
Rusty Russell [Tue, 10 Jun 2014 01:39:38 +0000 (11:09 +0930)]
talloc_link: remove it.

It's a prototype unused by anything else.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotal/link: remove incorrect references to talloc
Rusty Russell [Tue, 10 Jun 2014 01:38:56 +0000 (11:08 +0930)]
tal/link: remove incorrect references to talloc

Showing its origins in talloc_link.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotal: fix tal_check description
Rusty Russell [Tue, 10 Jun 2014 01:38:01 +0000 (11:08 +0930)]
tal: fix tal_check description

Cut & paste bug.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agoidtree: use ccan/tal instead of talloc
Rusty Russell [Tue, 10 Jun 2014 01:37:36 +0000 (11:07 +0930)]
idtree: use ccan/tal instead of talloc

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agojacobson_karels: New module
David Gibson [Sun, 1 Jun 2014 14:03:09 +0000 (00:03 +1000)]
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>
9 years agominmax: New module, safe min and max macros
David Gibson [Mon, 2 Jun 2014 12:37:28 +0000 (22:37 +1000)]
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>
9 years agocpuid: fix LICENSE file to be symlink.
Rusty Russell [Mon, 2 Jun 2014 23:50:52 +0000 (09:20 +0930)]
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>
9 years agocontainer_of: work with -Wcast-qual
Rusty Russell [Mon, 26 May 2014 03:40:02 +0000 (13:10 +0930)]
container_of: work with -Wcast-qual

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotools/ccanlint: detect more unmentioned dependencies.
Rusty Russell [Mon, 26 May 2014 03:27:44 +0000 (12:57 +0930)]
tools/ccanlint: detect more unmentioned dependencies.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agoantithread: correctly list ccan/typesafe_cb as dependency.
Rusty Russell [Tue, 27 May 2014 10:58:34 +0000 (20:28 +0930)]
antithread: correctly list ccan/typesafe_cb as dependency.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agoio: correctly list ccan/typesafe_cb as dependency.
Rusty Russell [Tue, 27 May 2014 10:57:20 +0000 (20:27 +0930)]
io: correctly list ccan/typesafe_cb as dependency.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotools/ccanlint: don't assert on relative directories for -d.
Rusty Russell [Mon, 26 May 2014 02:40:47 +0000 (12:10 +0930)]
tools/ccanlint: don't assert on relative directories for -d.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agotest: add test to ensure we can use non-const lists via check.
Rusty Russell [Mon, 26 May 2014 02:16:00 +0000 (11:46 +0930)]
test: add test to ensure we can use non-const lists via check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agonet: don't return still-connecting fd.
Rusty Russell [Tue, 27 May 2014 03:47:29 +0000 (13:17 +0930)]
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>
9 years agobitmap: Use const qualifiers where possible
David Gibson [Mon, 19 May 2014 11:21:48 +0000 (21:21 +1000)]
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>
9 years agoccan/bitmap: const for bitmap_test_bit.
David Gibson [Wed, 14 May 2014 05:13:26 +0000 (15:13 +1000)]
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>
9 years agonet: fix ipv4 immediate connect
Cody P Schafer [Sun, 26 Jan 2014 02:23:13 +0000 (18:23 -0800)]
net: fix ipv4 immediate connect

9 years agoio: don't close if already closing in io_close_other.
Rusty Russell [Sun, 13 Apr 2014 11:55:37 +0000 (21:25 +0930)]
io: don't close if already closing in io_close_other.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agoio: change io_idle() to io_wait()
Rusty Russell [Thu, 10 Apr 2014 11:48:36 +0000 (21:18 +0930)]
io: change io_idle() to io_wait()

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agoio: io_never for events that should never happen.
Rusty Russell [Tue, 8 Apr 2014 09:33:52 +0000 (19:03 +0930)]
io: io_never for events that should never happen.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agobitmap: use unsigned int for iterating over bitmap words
Emilio G. Cota [Mon, 10 Mar 2014 15:04:50 +0000 (11:04 -0400)]
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>
10 years agoio: call finish function after fd is actually closed.
Rusty Russell [Sun, 2 Mar 2014 06:05:10 +0000 (16:35 +1030)]
io: call finish function after fd is actually closed.

This turns out to be the right sequence for pettycoin, which
wants to reap the child in the finish routine.  From that sample
size of 1, this is clearly the Right Thing!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoEnhance CCAN_LIST_DEBUG to report original caller
Rusty Russell [Fri, 28 Feb 2014 01:42:11 +0000 (12:12 +1030)]
Enhance CCAN_LIST_DEBUG to report original caller

Simpler reimplementation of SS's patch; just plumb file and line through
inline functions in header.  We add a new check, which actually tests
these, and fix _info which missed ccan/check_type as a dependency.

Based-on-the-true-story-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: add float/double helpers.
Rusty Russell [Mon, 24 Feb 2014 03:26:32 +0000 (13:56 +1030)]
opt: add float/double helpers.

bfgminer/cgminer/sgminer want these.  Con implemented some,
but these are independently written (with tests!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: relicense to GPLv2+ (from GPLv3+)
Rusty Russell [Mon, 24 Feb 2014 02:55:19 +0000 (13:25 +1030)]
opt: relicense to GPLv2+ (from GPLv3+)

Acked by contributors:
Luke-Jr <luke@dashjr.org>:
 I don't have any objections
Douglas Bagnall <douglas@halo.gen.nz>:
Fine by me.
Joel Stanley <joel@jms.id.au>:
Fine with me.
Brad Hards <bradh@frogmouth.net>:
Ack.

No response from Joey (trivial warning patch) or Andreas Schlick (one
trivial patch, but he also wrote opt_free() (which was a 2 line function).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: don't wordwrap when description line starts with whitespace.
Rusty Russell [Tue, 11 Feb 2014 03:32:17 +0000 (14:02 +1030)]
opt: don't wordwrap when description line starts with whitespace.

This was suggested by Luke, though his version insisted on using tab.
This one is a bit more complex, but allows either tab or space.

Suggested-by: Luke Dashjr <luke-jr+git@utopios.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: test the new embedded-\n-in-usage behaviour.
Rusty Russell [Tue, 11 Feb 2014 02:47:44 +0000 (13:17 +1030)]
opt: test the new embedded-\n-in-usage behaviour.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: accept newline in help strings
Luke Dashjr [Fri, 7 Feb 2014 16:41:03 +0000 (16:41 +0000)]
opt: accept newline in help strings

This correctly continues on the next line indented.

Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan: add test for line-wrapping usage message.
Rusty Russell [Tue, 11 Feb 2014 02:36:24 +0000 (13:06 +1030)]
ccan: add test for line-wrapping usage message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: fix tests for 64-bit systems.
Rusty Russell [Thu, 6 Feb 2014 03:55:07 +0000 (14:25 +1030)]
opt: fix tests for 64-bit systems.

Actually, only an issue for 64 bit big endian systems, but still...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: test HAVE_SYS_TERMIOS_H via #if
Rusty Russell [Thu, 6 Feb 2014 03:51:40 +0000 (14:21 +1030)]
opt: test HAVE_SYS_TERMIOS_H via #if

As ccanlint warns.  Also, test TIOCGWINSZ before ioctl, rather than the
header directly since it's a little orthogonal.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agotools/configurator: add HAVE_SYS_TERMIOS_H
Rusty Russell [Thu, 6 Feb 2014 03:50:59 +0000 (14:20 +1030)]
tools/configurator: add HAVE_SYS_TERMIOS_H

As recently required by ccan/opt.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: avoid using %lld and %llx formats
Luke Dashjr [Wed, 5 Feb 2014 21:39:30 +0000 (21:39 +0000)]
opt: avoid using %lld and %llx formats

These are not supported in all environments, so use PRId64 and PRIu64 instead.

Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoopt: only use termios if HAVE_SYS_TERMIOS_H is defined
Luke Dashjr [Wed, 5 Feb 2014 21:27:40 +0000 (21:27 +0000)]
opt: only use termios if HAVE_SYS_TERMIOS_H is defined

This fixes building for Windows and other platforms which lack <sys/termios.h>

Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agobitmap: add endianness casts
Emilio G. Cota [Thu, 19 Dec 2013 06:00:15 +0000 (01:00 -0500)]
bitmap: add endianness casts

sparse yells at us when it realises we are implicitly casting an
endian type (big endian) to a plain unsigned long.

Get rid of this warning by telling sparse that we know what
we are doing.

Signed-off-by: Emilio G. Cota <cota@braap.org>
10 years agotimer: fix abortstring on 64 bit platforms.
Rusty Russell [Thu, 12 Dec 2013 04:56:50 +0000 (15:26 +1030)]
timer: fix abortstring on 64 bit platforms.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agonet: fix async connect to non-listening port.
Rusty Russell [Thu, 12 Dec 2013 04:55:46 +0000 (15:25 +1030)]
net: fix async connect to non-listening port.

In this case, Linux (at least, Ubuntu 13.10, x86-64 kernel 3.11.0-14-generic)
sets POLLHUP and gives no other error notification.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoio: io_always, and zero-length operations support.
Rusty Russell [Sat, 7 Dec 2013 07:10:47 +0000 (17:40 +1030)]
io: io_always, and zero-length operations support.

A zero-length read should complete immediately, even if the fd isn't readable.
Wire this up, and expose it for callers to use.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agocpuid: fix example compilation
Ahmed Samy [Sun, 1 Dec 2013 11:52:03 +0000 (13:52 +0200)]
cpuid: fix example compilation

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: Now we support extended feature testing.
Ahmed Samy [Fri, 29 Nov 2013 18:31:11 +0000 (20:31 +0200)]
cpuid: Now we support extended feature testing.

For now, we'll just have this and later on I'll make it support
writing it also using cpuid_write_info.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agoargcheck: a module to check argument ranges
Peter Hutterer [Thu, 21 Nov 2013 01:53:53 +0000 (11:53 +1000)]
argcheck: a module to check argument ranges

This code provides some macros to check arguments for valid value ranges.
Consider this a mild version of assert(3), because all it does is to log
a message and continue.

These macros don't replace error handling, but they are useful in
situations where an error is unexpected but not common, i.e.
this shouldn't happen but if it does let me know".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoio: io_close_other()
Rusty Russell [Fri, 15 Nov 2013 05:23:31 +0000 (15:53 +1030)]
io: io_close_other()

And add test for that which also tests duplex case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoio: Fix bug where duplex connection is last fd, when another gets deleted.
Rusty Russell [Fri, 15 Nov 2013 05:08:55 +0000 (15:38 +1030)]
io: Fix bug where duplex connection is last fd, when another gets deleted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoRevert "io: closing one side of a duplex connection closes both."
Rusty Russell [Thu, 14 Nov 2013 07:43:31 +0000 (18:13 +1030)]
Revert "io: closing one side of a duplex connection closes both."

This reverts commit 490b63852f281f0d72eb6f6dfa5e0dce36bcbe0d.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Conflicts:
ccan/io/io.c

10 years agocpuid: Introduce cpuid_write_info
Ahmed Samy [Thu, 28 Nov 2013 15:20:23 +0000 (17:20 +0200)]
cpuid: Introduce cpuid_write_info

This function writes CPU information to a file.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: documentation fix
Ahmed Samy [Tue, 26 Nov 2013 17:47:26 +0000 (19:47 +0200)]
cpuid: documentation fix

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Thu, 14 Nov 2013 02:29:41 +0000 (12:59 +1030)]
Merge branch 'master' of ozlabs.org:ccan

10 years agoio: add io_is_idle().
Rusty Russell [Thu, 14 Nov 2013 02:29:21 +0000 (12:59 +1030)]
io: add io_is_idle().

Turns out to be useful for complex cases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoio: handle duplex corner cases.
Rusty Russell [Thu, 14 Nov 2013 02:23:57 +0000 (12:53 +1030)]
io: handle duplex corner cases.

Especially where we have just done a read and spin off a duplex to do a read
as well.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agocpuid: remove un-needed bit shifting
Ahmed Samy [Wed, 13 Nov 2013 13:09:13 +0000 (15:09 +0200)]
cpuid: remove un-needed bit shifting

eax/ebx/ecx/edx are 32-bit registers, and we need 8 bits from most
significand bits so there is no need to mask out 0xFF.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Tue, 12 Nov 2013 10:12:01 +0000 (20:42 +1030)]
Merge branch 'master' of ozlabs.org:ccan

10 years agoio: closing one side of a duplex connection closes both.
Rusty Russell [Tue, 12 Nov 2013 10:11:06 +0000 (20:41 +1030)]
io: closing one side of a duplex connection closes both.

Otherwise, it's a PITA to close a duplexed connection.  If necessary we
can introduce a half-close to de-deplex later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agocpuid: parse L1 cache information for AMD.
Ahmed Samy [Mon, 11 Nov 2013 16:21:31 +0000 (18:21 +0200)]
cpuid: parse L1 cache information for AMD.

Also take out additional feature information from processor information
and feature bits since they can be tested using cpuid_test_feature() and
cpuid_has_feature()

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: small fix for non x86-cpus
Ahmed Samy [Mon, 11 Nov 2013 16:05:14 +0000 (18:05 +0200)]
cpuid: small fix for non x86-cpus

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Sat, 9 Nov 2013 10:17:20 +0000 (20:47 +1030)]
Merge branch 'master' of ozlabs.org:ccan

10 years agolist: fix list_prev and list_next on const lists.
Rusty Russell [Sat, 9 Nov 2013 10:16:58 +0000 (20:46 +1030)]
list: fix list_prev and list_next on const lists.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agocpuid: prefix cpuid_t enums with CPUID_* instead of CPU_*
Ahmed Samy [Fri, 8 Nov 2013 12:52:04 +0000 (14:52 +0200)]
cpuid: prefix cpuid_t enums with CPUID_* instead of CPU_*

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: drop support for testing extended features
Ahmed Samy [Thu, 7 Nov 2013 17:29:07 +0000 (19:29 +0200)]
cpuid: drop support for testing extended features

For now, we will just test for normal features, later on it'll be added
back.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: fix for MSVC in cpuid_is_supported()
Ahmed Samy [Thu, 7 Nov 2013 17:17:16 +0000 (19:17 +0200)]
cpuid: fix for MSVC in cpuid_is_supported()

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: parse additional feature information for pCPU_PROCINFO_AND_FEATUREBITS
Ahmed Samy [Thu, 7 Nov 2013 17:14:17 +0000 (19:14 +0200)]
cpuid: parse additional feature information for pCPU_PROCINFO_AND_FEATUREBITS

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: better parser for processor info
Ahmed Samy [Thu, 7 Nov 2013 17:06:16 +0000 (19:06 +0200)]
cpuid: better parser for processor info

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agoio: fix port clash in test.
Rusty Russell [Tue, 29 Oct 2013 10:42:57 +0000 (21:12 +1030)]
io: fix port clash in test.

Both run-set_alloc and run-15-timeout used the same port, so they sometimes
got stuck when running in parallel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agodaemonize / daemon_with_notify: ignore Ubuntu 13.10 brain death.
Rusty Russell [Tue, 29 Oct 2013 10:31:32 +0000 (21:01 +1030)]
daemonize / daemon_with_notify: ignore Ubuntu 13.10 brain death.

Apparently init --user adopts orphans.  To quote the author
Stewart Smith:

  As much as one can be happy in Ubuntu breaking something that has been
  true for what must be approaching 40 years, yep, I'm happy for you to
  make the changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agotime: to/from sec conversions.
Rusty Russell [Mon, 28 Oct 2013 11:27:16 +0000 (21:57 +1030)]
time: to/from sec conversions.

Trivial, but they make coding easier and more predictable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Mon, 28 Oct 2013 11:20:58 +0000 (21:50 +1030)]
Merge branch 'master' of ozlabs.org:ccan

10 years agocpuid: Use __asm for MSVC
Ahmed Samy [Fri, 25 Oct 2013 14:02:10 +0000 (16:02 +0200)]
cpuid: Use __asm for MSVC

MSVC only supports inline assembly and does not support the keyword
volatile for assembly.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: use a sprintf-like function to get cputype as a string
Ahmed Samy [Wed, 23 Oct 2013 15:39:25 +0000 (17:39 +0200)]
cpuid: use a sprintf-like function to get cputype as a string

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: avoid unions in parsing data
Ahmed Samy [Mon, 21 Oct 2013 11:45:19 +0000 (13:45 +0200)]
cpuid: avoid unions in parsing data

This is a much more cleaner way to do it and _should_ be easier for people
to use.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: apply the 32-bit fix
Ahmed Samy [Mon, 21 Oct 2013 10:24:36 +0000 (12:24 +0200)]
cpuid: apply the 32-bit fix

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agoio: add io_conn_fd()
Rusty Russell [Mon, 21 Oct 2013 05:33:58 +0000 (16:03 +1030)]
io: add io_conn_fd()

Useful for getsockname().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoio: io_set_alloc()
Rusty Russell [Mon, 21 Oct 2013 05:10:02 +0000 (15:40 +1030)]
io: io_set_alloc()

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: make union more generic.
Rusty Russell [Wed, 16 Oct 2013 09:20:12 +0000 (19:50 +1030)]
ccan/io: make union more generic.

I really wanted an array of bytes in there, so make it more flexible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoMerge branch 'master' of ozlabs.org:ccan
Ahmed Samy [Mon, 14 Oct 2013 23:45:27 +0000 (01:45 +0200)]
Merge branch 'master' of ozlabs.org:ccan

10 years agoMerge branch 'io'
Rusty Russell [Mon, 14 Oct 2013 11:03:51 +0000 (21:33 +1030)]
Merge branch 'io'

10 years agoccan/io: add examples.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: add examples.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: io_connect()
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: io_connect()

Not a perfect solution (we'd ideally want to go to another plan
immediately, but that would involve a malloc).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: flatten debug callchain further.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: flatten debug callchain further.

Don't call through io_loop, but have it pass the connection back
and call manually.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: flatten debug callchain.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: flatten debug callchain.

Don't call from the plan-construction function, call after it returns.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: update and improve documentation.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: update and improve documentation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: save errno on io_close, for finish functions.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: save errno on io_close, for finish functions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: handle errors on poll()
Rusty Russell [Mon, 14 Oct 2013 11:02:58 +0000 (21:32 +1030)]
ccan/io: handle errors on poll()

Without this, closing an fd results in a spin...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: io_close_cb()
Rusty Russell [Mon, 14 Oct 2013 11:02:57 +0000 (21:32 +1030)]
ccan/io: io_close_cb()

Overloading io_close() as a callback is ugly: create an explicit
io_close_cb().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: simplify I/O callbacks.
Rusty Russell [Mon, 14 Oct 2013 11:01:18 +0000 (21:31 +1030)]
ccan/io: simplify I/O callbacks.

Use a -1 for error codes.  This makes it easier to write your own io funcs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: io_set_finish()
Rusty Russell [Mon, 14 Oct 2013 11:01:16 +0000 (21:31 +1030)]
ccan/io: io_set_finish()

Rather than insisting on supplying them on every call to io_new_conn().
Also, this way it can be changed on a connection.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: test custom io functions.
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: test custom io functions.

And rename debug_io_plan() to io_plan_debug() so it can be exposed.

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