Changes in uspace/lib/c/generic/task.c [ae45201:0eff68e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/task.c
rae45201 r0eff68e 101 101 int task_spawnv(task_id_t *id, const char *path, const char *const args[]) 102 102 { 103 /* Connect to a program loader. */ 104 loader_t *ldr = loader_connect(); 105 if (ldr == NULL) 106 return EREFUSED; 107 108 /* Get task ID. */ 109 task_id_t task_id; 110 int rc = loader_get_task_id(ldr, &task_id); 111 if (rc != EOK) 112 goto error; 113 114 /* Send spawner's current working directory. */ 115 rc = loader_set_cwd(ldr); 116 if (rc != EOK) 117 goto error; 118 119 /* Send program pathname. */ 120 rc = loader_set_pathname(ldr, path); 121 if (rc != EOK) 122 goto error; 123 124 /* Send arguments. */ 125 rc = loader_set_args(ldr, args); 126 if (rc != EOK) 127 goto error; 128 103 129 /* Send default files */ 104 130 fdi_node_t *files[4]; … … 124 150 files[3] = NULL; 125 151 126 return task_spawnvf(id, path, args, files);127 }128 129 /** Create a new task by running an executable from the filesystem.130 *131 * This is really just a convenience wrapper over the more complicated132 * loader API. Arguments are passed as a null-terminated array of strings.133 * Files are passed as null-terminated array of pointers to fdi_node_t.134 *135 * @param id If not NULL, the ID of the task is stored here on success.136 * @param path Pathname of the binary to execute.137 * @param argv Command-line arguments.138 * @param files Standard files to use.139 *140 * @return Zero on success or negative error code.141 *142 */143 int task_spawnvf(task_id_t *id, const char *path, const char *const args[],144 fdi_node_t *const files[])145 {146 /* Connect to a program loader. */147 loader_t *ldr = loader_connect();148 if (ldr == NULL)149 return EREFUSED;150 151 /* Get task ID. */152 task_id_t task_id;153 int rc = loader_get_task_id(ldr, &task_id);154 if (rc != EOK)155 goto error;156 157 /* Send spawner's current working directory. */158 rc = loader_set_cwd(ldr);159 if (rc != EOK)160 goto error;161 162 /* Send program pathname. */163 rc = loader_set_pathname(ldr, path);164 if (rc != EOK)165 goto error;166 167 /* Send arguments. */168 rc = loader_set_args(ldr, args);169 if (rc != EOK)170 goto error;171 172 /* Send files */173 152 rc = loader_set_files(ldr, files); 174 153 if (rc != EOK) … … 190 169 191 170 return EOK; 171 192 172 error: 193 173 /* Error exit */
Note:
See TracChangeset
for help on using the changeset viewer.