Changes in uspace/lib/c/generic/loader.c [b7fd2a0:d96d9bc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/loader.c
rb7fd2a0 rd96d9bc 52 52 * @param name Symbolic name to set on the newly created task. 53 53 * 54 * @return Error code. 55 */ 56 errno_t loader_spawn(const char *name) 57 { 58 return (errno_t) __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER, 54 * @return Pointer to the loader connection structure (should be 55 * deallocated using free() after use). 56 * 57 */ 58 int loader_spawn(const char *name) 59 { 60 return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER, 59 61 (sysarg_t) name, str_size(name)); 60 62 } … … 84 86 * @param task_id Points to a variable where the ID should be stored. 85 87 * 86 * @return Zero on success or anerror code.87 * 88 */ 89 errno_t loader_get_task_id(loader_t *ldr, task_id_t *task_id)88 * @return Zero on success or negative error code. 89 * 90 */ 91 int loader_get_task_id(loader_t *ldr, task_id_t *task_id) 90 92 { 91 93 /* Get task ID. */ … … 94 96 ipc_call_t answer; 95 97 aid_t req = async_send_0(exch, LOADER_GET_TASKID, &answer); 96 errno_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t));98 sysarg_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t)); 97 99 98 100 async_exchange_end(exch); … … 100 102 if (rc != EOK) { 101 103 async_forget(req); 102 return ( errno_t) rc;104 return (int) rc; 103 105 } 104 106 105 107 async_wait_for(req, &rc); 106 return ( errno_t) rc;108 return (int) rc; 107 109 } 108 110 … … 113 115 * @param ldr Loader connection structure. 114 116 * 115 * @return Zero on success or anerror code.116 * 117 */ 118 errno_t loader_set_cwd(loader_t *ldr)117 * @return Zero on success or negative error code. 118 * 119 */ 120 int loader_set_cwd(loader_t *ldr) 119 121 { 120 122 char *cwd = (char *) malloc(MAX_PATH_LEN + 1); … … 131 133 ipc_call_t answer; 132 134 aid_t req = async_send_0(exch, LOADER_SET_CWD, &answer); 133 errno_t rc = async_data_write_start(exch, cwd, len);135 sysarg_t rc = async_data_write_start(exch, cwd, len); 134 136 135 137 async_exchange_end(exch); … … 138 140 if (rc != EOK) { 139 141 async_forget(req); 140 return ( errno_t) rc;142 return (int) rc; 141 143 } 142 144 143 145 async_wait_for(req, &rc); 144 return ( errno_t) rc;146 return (int) rc; 145 147 } 146 148 … … 151 153 * @param file Program file. 152 154 * 153 * @return Zero on success or anerror code.154 * 155 */ 156 errno_t loader_set_program(loader_t *ldr, const char *name, int file)155 * @return Zero on success or negative error code. 156 * 157 */ 158 int loader_set_program(loader_t *ldr, const char *name, int file) 157 159 { 158 160 async_exch_t *exch = async_exchange_begin(ldr->sess); … … 161 163 aid_t req = async_send_0(exch, LOADER_SET_PROGRAM, &answer); 162 164 163 errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);165 sysarg_t rc = async_data_write_start(exch, name, str_size(name) + 1); 164 166 if (rc == EOK) { 165 167 async_exch_t *vfs_exch = vfs_exchange_begin(); … … 172 174 if (rc != EOK) { 173 175 async_forget(req); 174 return ( errno_t) rc;176 return (int) rc; 175 177 } 176 178 177 179 async_wait_for(req, &rc); 178 return ( errno_t) rc;180 return (int) rc; 179 181 } 180 182 … … 184 186 * @param path Program path. 185 187 * 186 * @return Zero on success or anerror code.187 * 188 */ 189 errno_t loader_set_program_path(loader_t *ldr, const char *path)188 * @return Zero on success or negative error code. 189 * 190 */ 191 int loader_set_program_path(loader_t *ldr, const char *path) 190 192 { 191 193 const char *name = str_rchr(path, '/'); … … 196 198 } 197 199 198 int fd; 199 errno_t rc = vfs_lookup(path, 0, &fd); 200 if (rc != EOK) { 201 return rc; 202 } 203 204 rc = loader_set_program(ldr, name, fd); 200 int fd = vfs_lookup(path, 0); 201 if (fd < 0) { 202 return fd; 203 } 204 205 int rc = loader_set_program(ldr, name, fd); 205 206 vfs_put(fd); 206 207 return rc; … … 217 218 * @param argv NULL-terminated array of pointers to arguments. 218 219 * 219 * @return Zero on success or anerror code.220 * 221 */ 222 errno_t loader_set_args(loader_t *ldr, const char *const argv[])220 * @return Zero on success or negative error code. 221 * 222 */ 223 int loader_set_args(loader_t *ldr, const char *const argv[]) 223 224 { 224 225 /* … … 252 253 ipc_call_t answer; 253 254 aid_t req = async_send_0(exch, LOADER_SET_ARGS, &answer); 254 errno_t rc = async_data_write_start(exch, (void *) arg_buf,255 sysarg_t rc = async_data_write_start(exch, (void *) arg_buf, 255 256 buffer_size); 256 257 … … 260 261 if (rc != EOK) { 261 262 async_forget(req); 262 return ( errno_t) rc;263 return (int) rc; 263 264 } 264 265 265 266 async_wait_for(req, &rc); 266 return ( errno_t) rc;267 return (int) rc; 267 268 } 268 269 … … 273 274 * @param file The file's descriptor. 274 275 * 275 * @return Zero on success or anerror code.276 * 277 */ 278 errno_t loader_add_inbox(loader_t *ldr, const char *name, int file)276 * @return Zero on success or negative error code. 277 * 278 */ 279 int loader_add_inbox(loader_t *ldr, const char *name, int file) 279 280 { 280 281 async_exch_t *exch = async_exchange_begin(ldr->sess); … … 283 284 aid_t req = async_send_0(exch, LOADER_ADD_INBOX, NULL); 284 285 285 errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);286 sysarg_t rc = async_data_write_start(exch, name, str_size(name) + 1); 286 287 if (rc == EOK) { 287 288 rc = vfs_pass_handle(vfs_exch, file, exch); … … 297 298 } 298 299 299 return ( errno_t) rc;300 return (int) rc; 300 301 } 301 302 … … 307 308 * @param ldr Loader connection structure. 308 309 * 309 * @return Zero on success or anerror code.310 * 311 */ 312 errno_t loader_load_program(loader_t *ldr)313 { 314 async_exch_t *exch = async_exchange_begin(ldr->sess); 315 errno_t rc = async_req_0_0(exch, LOADER_LOAD);310 * @return Zero on success or negative error code. 311 * 312 */ 313 int loader_load_program(loader_t *ldr) 314 { 315 async_exch_t *exch = async_exchange_begin(ldr->sess); 316 int rc = async_req_0_0(exch, LOADER_LOAD); 316 317 async_exchange_end(exch); 317 318 … … 330 331 * @param ldr Loader connection structure. 331 332 * 332 * @return Zero on success or anerror code.333 * 334 */ 335 errno_t loader_run(loader_t *ldr)336 { 337 async_exch_t *exch = async_exchange_begin(ldr->sess); 338 errno_t rc = async_req_0_0(exch, LOADER_RUN);333 * @return Zero on success or negative error code. 334 * 335 */ 336 int loader_run(loader_t *ldr) 337 { 338 async_exch_t *exch = async_exchange_begin(ldr->sess); 339 int rc = async_req_0_0(exch, LOADER_RUN); 339 340 async_exchange_end(exch); 340 341 … … 356 357 * @param ldr Loader connection structure. 357 358 * 358 * @return Zero on success or anerror code.359 * @return Zero on success or negative error code. 359 360 * 360 361 */
Note:
See TracChangeset
for help on using the changeset viewer.