Changes in uspace/lib/net/adt/module_map.c [25d2de69:61bfc370] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/adt/module_map.c
r25d2de69 r61bfc370 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_ref modules, const char*name,66 const char*filename, services_t service, task_id_t task_id,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, 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_ref modules, char*name)106 module_t *get_running_module(modules_t *modules, uint8_t *name) 108 107 { 109 module_ refmodule;108 module_t *module; 110 109 111 110 module = modules_find(modules, name, 0); … … 114 113 115 114 if (!module->task_id) { 116 module->task_id = spawn(module->filename);115 module->task_id = net_spawn(module->filename); 117 116 if (!module->task_id) 118 117 return NULL; … … 124 123 } 125 124 126 /** Start sthe given module.125 /** Start the given module. 127 126 * 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. 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 * 131 132 */ 132 task_id_t spawn(const char*fname)133 task_id_t net_spawn(const uint8_t *fname) 133 134 { 134 const char *argv[2];135 task_id_t res;135 task_id_t id; 136 int rc; 136 137 137 argv[0] = fname;138 argv[1] = NULL;139 res = task_spawn(fname, argv, NULL);138 rc = task_spawnl(&id, (const char *) fname, (const char *) fname, NULL); 139 if (rc != EOK) 140 return 0; 140 141 141 return res;142 return id; 142 143 } 143 144
Note:
See TracChangeset
for help on using the changeset viewer.