5 #include <frsh_resources.h>
7 #ifdef FRSH_DISTRIBUTED_MODULE_SUPPORTED
8 #include <frsh_distributed.h>
11 #ifdef CONFIG_RESOURCE_DUMMY
12 #include <res_dummy.h>
15 #ifdef CONFIG_RESOURCE_ITEM
19 struct frsh_forb frsh_forb_global;
21 static void *alloc_executor_thread(void *arg)
23 return (void*)forb_executor_run(&frsh_forb_global.alloc_executor);
31 frsh_forb_global.orb = forb_init(NULL, NULL, "frsh");
32 if (!frsh_forb_global.orb) {
33 if (errno) return errno;
37 frsh_forb_global.fcb = forb_resolve_reference(frsh_forb_global.orb,
38 fres_contract_broker_reg_name);
39 if (!frsh_forb_global.fcb) {
40 ret = FRES_ERR_FCB_NOT_RUNNING;
44 /* Initialize resource allocators */
45 ret = forb_executor_init(&frsh_forb_global.alloc_executor);
48 #ifdef CONFIG_RESOURCE_DUMMY
49 ret = fra_dummy_init(frsh_forb_global.orb, frsh_forb_global.fcb,
50 &frsh_forb_global.alloc_executor);
54 #ifdef FRSH_DISTRIBUTED_MODULE_SUPPORTED
55 ret = frsh_distributed_init();
59 #ifdef CONFIG_RESOURCE_ITEM
60 ret = fra_item_init(frsh_forb_global.orb, frsh_forb_global.fcb,
61 &frsh_forb_global.alloc_executor);
64 /* Run resource allocators */
65 fosa_thread_create(&frsh_forb_global.alloc_executor_thread, NULL,
66 alloc_executor_thread, NULL);