Libecoli  0.11.3
Extensible COmmand LIne library
init.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
3  */
4 
12 #pragma once
13 
14 #include <sys/queue.h>
15 
29 #define EC_INIT_REGISTER(t) \
30  static void ec_init_init_##t(void); \
31  static void __attribute__((constructor, used)) ec_init_init_##t(void) \
32  { \
33  ec_init_register(&t); \
34  }
35 
39 typedef int(ec_init_t)(void);
40 
44 typedef void(ec_exit_t)(void);
45 
46 TAILQ_HEAD(ec_init_list, ec_init);
47 
51 struct ec_init {
52  TAILQ_ENTRY(ec_init) next;
53  ec_init_t *init;
54  ec_exit_t *exit;
55  unsigned int priority;
56 };
57 
64 void ec_init_register(struct ec_init *test);
65 
74 int ec_init(void);
75 
79 void ec_exit(void);
80 
int ec_init(void)
int() ec_init_t(void)
Definition: init.h:39
void ec_exit(void)
void() ec_exit_t(void)
Definition: init.h:44
void ec_init_register(struct ec_init *test)
Definition: init.h:51