]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/lib/minilibc/construction.c
update
[l4.git] / kernel / fiasco / src / lib / minilibc / construction.c
1
2 #include "initfini.h"
3 #include "types.h"
4
5 typedef void (*ctor_t)(void);
6
7 extern ctor_t __CTOR_END__[];
8 extern ctor_t __DTOR_END__[];
9 extern ctor_t __CTOR_LIST__[];
10 extern ctor_t __DTOR_LIST__[];
11
12
13 static int construction_done = 0;
14
15 void static_construction()
16 {
17   ctor_t *cons = __CTOR_LIST__;
18   while(cons != __CTOR_END__)
19     if(*(--cons))
20       (*cons)();
21
22   construction_done = 1;
23 }
24
25
26 void static_destruction()
27 {
28   ctor_t *cons = __DTOR_LIST__;
29   if(!construction_done)
30     return;
31
32   while(cons != __DTOR_END__)
33     if(*(--cons))
34       (*cons)();
35 }