Changeset 54d4b9e in mainline for uspace/lib/c/generic/task.c
- Timestamp:
- 2011-06-17T17:53:05Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dec55ce
- Parents:
- 8d12065 (diff), 98caf49 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/task.c
r8d12065 r54d4b9e 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 129 103 /* Send default files */ 130 104 fdi_node_t *files[4]; … … 150 124 files[3] = NULL; 151 125 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 complicated 132 * 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 */ 152 173 rc = loader_set_files(ldr, files); 153 174 if (rc != EOK) … … 169 190 170 191 return EOK; 171 172 192 error: 173 193 /* Error exit */
Note:
See TracChangeset
for help on using the changeset viewer.