Libecoli  0.10.1
Extensible COmmand LIne library
init.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
3  */
4 
10 #pragma once
11 
12 #include <sys/queue.h>
13 
27 #define EC_INIT_REGISTER(t) \
28  static void ec_init_init_##t(void); \
29  static void __attribute__((constructor, used)) ec_init_init_##t(void) \
30  { \
31  ec_init_register(&t); \
32  }
33 
37 typedef int(ec_init_t)(void);
38 
42 typedef void(ec_exit_t)(void);
43 
44 TAILQ_HEAD(ec_init_list, ec_init);
45 
49 struct ec_init {
50  TAILQ_ENTRY(ec_init) next;
51  ec_init_t *init;
52  ec_exit_t *exit;
53  unsigned int priority;
54 };
55 
62 void ec_init_register(struct ec_init *test);
63 
72 int ec_init(void);
73 
77 void ec_exit(void);
78 
int ec_init(void)
int() ec_init_t(void)
Definition: init.h:37
void ec_exit(void)
void() ec_exit_t(void)
Definition: init.h:42
void ec_init_register(struct ec_init *test)
Definition: init.h:49