1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
6 * Register initialization routines.
12 #include <sys/queue.h>
14 #include <ecoli_log.h>
15 #include <ecoli_node.h>
17 #define EC_INIT_REGISTER(t) \
18 static void ec_init_init_##t(void); \
19 static void __attribute__((constructor, used)) \
20 ec_init_init_##t(void) \
22 ec_init_register(&t); \
26 * Type of init function. Return 0 on success, -1 on error.
28 typedef int (ec_init_t)(void);
30 TAILQ_HEAD(ec_init_list, ec_init);
33 * A structure describing a test case.
36 TAILQ_ENTRY(ec_init) next; /**< Next in list. */
37 ec_init_t *init; /**< Init function. */
38 unsigned int priority; /**< Priority (0=first, 99=last) */
42 * Register an initialization function.
45 * A pointer to a ec_init structure to be registered.
47 void ec_init_register(struct ec_init *test);
50 * Initialize ecoli library
52 * Must be called before any other function from libecoli, except
53 * ec_malloc_register().
56 * 0 on success, -1 on error (errno is set).