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