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