Skip to content
Commits on May 9, 2016
  1. @dgibson

    Build info files

    All modules have a _info file (a C file, despite the lack of extension)
    giving metadata for the module.  The Makefiles have a rule to build these..
    but it's broken (missing an include directive).
    This patch fixes the rule, and builds the info binaries for all modules by
    default.  This is a useful check and also useful for manually inspecting
    a module's metadata.
    Signed-off-by: David Gibson <>
    dgibson committed May 9, 2016
  2. @dgibson

    Automatically determine which modules have source

    Currently, build of ccan is controlled by two Make variables: MODS_WITH_SRC
    and MODS_NO_SRC which list modules containing .c files, and modules with
    only .h files respectively.
    When adding new modules this is fiddly to get right, and there are a number
    of modules already listed in the wrong variable.  There's also some
    redundant logic in the DIRS variable to again filter out modules without
    This simplifies things by having a single manually updated MODS variable
    listing every module, and determining MODS_WITH_SOURCE programmatically.
    Signed-off-by: David Gibson <>
    dgibson committed May 5, 2016
  3. Makefile: exclude altstack so Jenkins works again.

    Signed-off-by: Rusty Russell <>
    committed May 9, 2016
  4. ccanlint: fix missing file.

    Signed-off-by: Rusty Russell <>
    committed May 9, 2016
Commits on May 6, 2016
  1. tools/ccanlint: make sure _info compiles.

    We used to crash, as reported by Stephen M. Cameron
    Closes: #39
    Signed-off-by: Rusty Russell <>
    committed May 6, 2016
Commits on May 3, 2016
  1. a_star: new module added to hacky Makefile-ccan list.

    Signed-off-by: Rusty Russell <>
    committed May 4, 2016
  2. @smcameron

    Add A-star module

    Signed-off-by: Stephen M. Cameron <>
    smcameron committed May 2, 2016
Commits on Apr 29, 2016
  1. @dgibson

    Correctly include dependencies for nested modules

    Currently we pull auto-generated dependencies into the Makefile with
    include ccan/*/*.d.  That will omit any .d files from nested modules,
    meaning things might not be correctly rebuilt there.
    Correct this by using the list of modules instead of a 1-level wildcard.
    Signed-off-by: David Gibson <>
    dgibson committed Feb 16, 2016
  2. @dgibson

    Exclude system headers from .d files

    We currently generated .d dependency files with the -MD option to cc.  That
    includes system header files in the dependencies, which isn't often useful
    and makes the .d more complicated than necessary.
    This changes to -MMD which excludes system headers.
    Signed-off-by: David Gibson <>
    dgibson committed Feb 16, 2016
  3. @dgibson

    Clean up use of 'rm' in Makefiles

    Most of the ccan Makefiles use $(RM) to remove files.  However, 'rm' is
    traditionally considered one of the few shell tools which can be used in
    Makefiles without indirecting via a variable.
    rm is also typically invoked with -f in Makefiles, so that it doesn't cause
    errors if the files don't exist (because they haven't been built).  A
    number of instances in ccan were missing this.
    This corrects these warts.
    Signed-off-by: David Gibson <>
    dgibson committed Feb 16, 2016
  4. @dgibson

    Add missing files to make clean

    At present, "make clean" will not remove the module-Makefile files for
    non-top-level modules.  It also won't remove the generated config.h.
    Correct those errors.
    Signed-off-by: David Gibson <>
    dgibson committed Feb 16, 2016
Commits on Apr 26, 2016
  1. configurator: fix HAVE_UCONTEXT test on Ubuntu 16.04.

    Seems to want more stack.
    Signed-off-by: Rusty Russell <>
    committed Apr 26, 2016
  2. generator: don't even try to compile if !HAVE_UCONTEXT.

    Signed-off-by: Rusty Russell <>
    committed Apr 26, 2016
  3. Makefile: add altstack and generator to build exclusions.

    Signed-off-by: Rusty Russell <>
    committed Apr 26, 2016
  4. Makefile: fix random pattern hack.

    Turns out that patterns with / cause % to match /.  OK...
    Signed-off-by: Rusty Russell <>
    committed Apr 26, 2016
  5. Makefile-ccan: add cppmagic.

    Signed-off-by: Rusty Russell <>
    committed Apr 26, 2016
  6. htable: add iterators to htable_type.

    Useful if you have more than one object with same key.
    Signed-off-by: Rusty Russell <>
    committed Apr 26, 2016
Commits on Mar 25, 2016
  1. @amboar

    strgrp: Add cosine fudge-curve to unify filter comparison spaces

    If we are to use should_grp_score_cos(x,y) as a filter the the following
    relationship must hold (from least to most expensive):
                    >= should_grp_score_cos(x,y)
                    >= grp_score(x)
    should_grp_score_cos(x,y) wasn't holding up its part of the bargain, so
    real data was used to generate a fudge curve to bring
    should_grp_score_cos(x,y) results into the same space. Really this is a
    terrible hack and the problem needs more thought. Evaluation of
    should_grp_score_cos(x,y)'s performance benefit (given the relaxation of
    the filter under the fudge curve) is sorely needed.
    amboar committed Feb 20, 2016
  2. @amboar

    strgrp: Use angular similarity for distance metric properties

    Distance metrics allow us to compare similarity results, however
    applying the change leads to test suite breakage as we no longer satisfy
    the requirement that each filter's score is at most as large as that of
    the previous filter^. As such, also stop ccanlint from executing the
    tests that are known to fail until we work around the problem.
    ^ This is a problem that has existed since the introduction of the
    cosine similarity filter, it just wasn't detected by the test suite.
    amboar committed Feb 20, 2016
  3. @amboar

    strgrp: Use ratio of hypotenuse for consistent comparisons

    Ensure comparing filter results is sensible by using a consistent
    calculation. Note that the cosine similarity measurement doesn't yet
    conform and this can give spurious results that are not detected by the
    test suite.
    amboar committed Feb 20, 2016
  4. @amboar

    strgrp: Shift constant out of loop

    Likely this was optimised away, but the code now represents the intent.
    amboar committed Feb 20, 2016
Commits on Mar 8, 2016
  1. shachain: clarify design in terms of binary tree, reverse indexes.

    Olaoluwa Osuntokun came up with an alternative which used binary trees;
    that's a much better way to explain it, so do that in design.txt and
    update the implementation to work the same way.
    Anthony Towns pointed out that the numbering is the reverse of the normal
    hash chaining descriptions, so fix that too.
    Signed-off-by: Rusty Russell <>
    committed Mar 8, 2016
Commits on Feb 25, 2016
  1. @dgibson

    generator: Allow generators to take arguments

    Using some serious macro magic, this patch extends generators to allow
    them to take arbitrary arguments.  The arguments are marshalled into a
    structure placed at the far end of the generator's stack when it is
    created.  Then, they're unmarshalled back into C parameters when we first
    context switch into the generator.
    Signed-off-by: David Gibson <>
    dgibson committed Feb 12, 2016
  2. @dgibson

    generator: Generators for C

    Generators are a limited form of co-routine, which people may be familiar
    with from Python.  This module adds an implementation of generators for C.
    Signed-off-by: David Gibson <>
    dgibson committed Feb 25, 2016
  3. @dgibson

    configurator: Add test for ucontext.h

    This adds a new HAVE_UCONTEXT define, which indicates that ucontext.h
    is present, and more-or-less works.
    It also adds HAVE_POINTER_SAFE_MAKECONTEXT, which indicates whether
    pointer valued arguments can be passed through the varargs parameters
    to makecontext().
    Signed-off-by: David Gibson <>
    dgibson committed Jul 19, 2014
Commits on Feb 15, 2016
  1. @dgibson

    altstack: Clarify checking macros

    The chkfail() and chkok() macros in altstack's test program are pretty
    difficult to read.  More importantly, though, they do all their tests with
    one big ok1().  That means if the test fails, you get no indication which
    of the checks was actually wrong, making debugging harder.
    This reworks the macros into a more verbose form that's easier to read,
    and splits them into multiple ok1() tests to make failures more explicit.
    Signed-off-by: David Gibson <>
    dgibson committed Feb 15, 2016
  2. @dgibson

    altstack: Declare memory clobbers

    altstack includes a couple of inline asm blocks with x86 push and pop
    instructions.  These instructions will access memory (the stack), but
    that's not declared in inline asm statement.  We seem to be getting away
    with it, but in theory that could allow the compiler to re-order accesses
    to local variables across the asm block.  Since those blocks change the
    location of the stack, that could be very bad.
    Adding a "memory" clobber should prevent this (effectively making the asm
    blocks a compiler memory barrier).
    Signed-off-by: David Gibson <>
    dgibson committed Feb 15, 2016
  3. @dgibson

    altstack: Include config.h in run.c

    ccan programs should always include config.h before anything else to make
    sure everything is set up correctly.  Doing so in altstack's run.c means
    it no longer needs an explicit _XOPEN_SOURCE 700, since _GNU_SOURCE is set
    in config.h (for GNU libc, anyway).
    Signed-off-by: David Gibson <>
    dgibson committed Feb 15, 2016
  4. @dgibson

    altstack: Increase signal stack size

    At present the altstack module uses a stack of size MINSIGSTKSZ for its
    SIGSEGV handler.  Although MINSIGSTKSZ is defined to be large enough to
    execute a signal handler, it doesn't guarantee that you can do anything
    very much within it.
    With certain libc versions, MINSIGSTKSZ is not enough to execute the
    longjmp() used in altstack.  Specfically, with Ubuntu 12.04 (the default
    install for Travis containers), the first time longjmp() is executed the
    symbol must be resolved by the dynamic linker in a process which overruns
    the MINSIGSTKSZ sized stack.  That then corrupts local variables in
    altstack() itself causing a number of subsequent failures.
    This patch addresses the problem by changing from MINSIGSTKSZ to SIGSTKSZ
    which is supposed to cover "the usual requirements for an alternate signal
    Signed-off-by: David Gibson <>
    dgibson committed Feb 15, 2016
Commits on Feb 8, 2016
  1. @dancancode

    altstack: stack alignment and accounting tweaks

    * add altstack_remn, returns amount of stack remaining
    * increase mapping by 1 page to handle abutment case
    * capture rsp earlier
    * align stack to 16 bytes
    Signed-off-by: Dan Good <>
    dancancode committed Feb 8, 2016
Commits on Feb 5, 2016
  1. ccanlint: make _info ported an empty string on success.

    Otherwise it describes what we need.
    Signed-off-by: Rusty Russell <>
    committed Feb 5, 2016
Commits on Feb 3, 2016
  1. @dgibson

    cppmagic: Iteration

    This implements macros which iterate across their arguments.  This is
    implemented in terms of (kinda sorta) recursion.  In fact, they will stop
    working with enough arguments, but the limit is large and can be easily
    increased by changing the depth of the CPPMAGIC_EVAL() macro.
    There are 3 iterators (for now):
        applies another macro to each of its remaining arguments - the results
        are comma separated, so they can be passed into another CPPMAGIC_MAP
        does the same thing, but takes the arguments a pair at a time, using
        a supplied two-argument macro.
        combines the arguments with a chosen delimiter (effectively replacing
    the commas between the arguments with the delimiter)
    same thing, but takes the arguments a pair at a time.
    Signed-off-by: David Gibson <>
    dgibson committed Jan 26, 2016
  2. @dgibson

    cppmagic: Allow multiple and deferred evaluation

    Recursion (and therefore iteration) in cpp is difficult, since the
    preprocessor explicitly looks for and inhibits recursion.
    But, it's possible to trick it, up to a point.  CPPMAGIC_DEFER1() and
    CPPMAGIC_DEFER2() can "hide" a macro, preventing it from being expanded
    and being noticed as recursion.
    Along with that we need to cause extra expansion passes to be executed.
    There has to be a finite limit here - true recursion is impossible - but
    that number can be made very large pretty easily.  CPPMAGIC_EVAL() multiply
    expands its argument(s) - up to 1024 times.
    Signed-off-by: David Gibson <>
    dgibson committed Jan 26, 2016
  3. @dgibson

    cppmagic: Conditionals

    Implement CPPMAGIC_IFELSE which operates similar to the C ? : operator, but
    is evaluated at preprocessing time.
    Signed-off-by: David Gibson <>
    dgibson committed Jan 26, 2016
  4. @dgibson

    cppmagic: Logical operations

    In order to implement fancier things, we need to represent truth values in
    cpp.  We use '0' and '1' strings, like in C, but we need ways to get these
    values from other conditions.
    CPPMAGIC_ISZERO() and CPPMAGIC_NONZERO() test if the argument is '0' or
    anything else (ISZERO doubles as a logical not).
    CPPMAGIC_ISEMPTY() and CPPMAGIC_NON_EMPTY() expand to 0 or 1 depending on
    whether they have any arguments at all or not.
    Signed-off-by: David Gibson <>
    dgibson committed Jan 26, 2016
Something went wrong with that request. Please try again.