Changes in uspace/lib/net/adt/module_map.c [61bfc370:25d2de69] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/adt/module_map.c
r61bfc370 r25d2de69 38 38 #include <task.h> 39 39 #include <unistd.h> 40 #include <err no.h>40 #include <err.h> 41 41 42 42 #include <ipc/services.h> … … 59 59 * running. 60 60 * @param[in] connect_module The module connecting function. 61 * @return EOK on success.62 * @return ENOMEM if there is not enough memory left.61 * @returns EOK on success. 62 * @returns ENOMEM if there is not enough memory left. 63 63 */ 64 64 int 65 add_module(module_ t **module, modules_t *modules, const uint8_t*name,66 const uint8_t*filename, services_t service, task_id_t task_id,65 add_module(module_ref *module, modules_ref modules, const char *name, 66 const char *filename, services_t service, task_id_t task_id, 67 67 connect_module_t connect_module) 68 68 { 69 module_t *tmp_module; 70 int rc; 69 ERROR_DECLARE; 71 70 72 tmp_module = (module_t *) malloc(sizeof(module_t)); 71 module_ref tmp_module; 72 73 tmp_module = (module_ref) malloc(sizeof(module_t)); 73 74 if (!tmp_module) 74 75 return ENOMEM; … … 82 83 tmp_module->connect_module = connect_module; 83 84 84 rc = modules_add(modules, tmp_module->name, 0, tmp_module);85 if (rc != EOK) {85 if (ERROR_OCCURRED(modules_add(modules, tmp_module->name, 0, 86 tmp_module))) { 86 87 free(tmp_module); 87 return rc;88 return ERROR_CODE; 88 89 } 89 90 if (module) … … 100 101 * @param[in] modules The module map. 101 102 * @param[in] name The module name. 102 * @return The running module found. It does not have to be103 * @returns The running module found. It does not have to be 103 104 * connected. 104 * @return NULL if there is no such module.105 * @returns NULL if there is no such module. 105 106 */ 106 module_ t *get_running_module(modules_t *modules, uint8_t*name)107 module_ref get_running_module(modules_ref modules, char *name) 107 108 { 108 module_ t *module;109 module_ref module; 109 110 110 111 module = modules_find(modules, name, 0); … … 113 114 114 115 if (!module->task_id) { 115 module->task_id = net_spawn(module->filename);116 module->task_id = spawn(module->filename); 116 117 if (!module->task_id) 117 118 return NULL; … … 123 124 } 124 125 125 /** Start the given module.126 /** Starts the given module. 126 127 * 127 * @param[in] fname The module full or relative path filename. 128 * 129 * @return The new module task identifier on success. 130 * @return Zero if there is no such module. 131 * 128 * @param[in] fname The module full or relative path filename. 129 * @returns The new module task identifier on success. 130 * @returns Zero if there is no such module. 132 131 */ 133 task_id_t net_spawn(const uint8_t*fname)132 task_id_t spawn(const char *fname) 134 133 { 135 task_id_t id;136 int rc;134 const char *argv[2]; 135 task_id_t res; 137 136 138 rc = task_spawnl(&id, (const char *) fname, (const char *) fname, NULL);139 if (rc != EOK)140 return 0;137 argv[0] = fname; 138 argv[1] = NULL; 139 res = task_spawn(fname, argv, NULL); 141 140 142 return id;141 return res; 143 142 } 144 143
Note:
See TracChangeset
for help on using the changeset viewer.