Changes in uspace/lib/net/adt/module_map.c [1bfd3d3:25d2de69] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/adt/module_map.c
r1bfd3d3 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 char *name,65 add_module(module_ref *module, modules_ref modules, const char *name, 66 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, char *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); … … 126 127 * 127 128 * @param[in] fname The module full or relative path filename. 128 * @return The new module task identifier on success.129 * @return Zero if there is no such module.129 * @returns The new module task identifier on success. 130 * @returns Zero if there is no such module. 130 131 */ 131 132 task_id_t spawn(const char *fname) 132 133 { 133 task_id_t id;134 int rc;134 const char *argv[2]; 135 task_id_t res; 135 136 136 rc = task_spawnl(&id, fname, fname, NULL);137 if (rc != EOK)138 return 0;137 argv[0] = fname; 138 argv[1] = NULL; 139 res = task_spawn(fname, argv, NULL); 139 140 140 return id;141 return res; 141 142 } 142 143
Note:
See TracChangeset
for help on using the changeset viewer.