Changeset 04803bf in mainline for uspace/lib/c/generic/loader.c
- Timestamp:
- 2011-03-21T22:00:17Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e3
- Parents:
- b50b5af2 (diff), 7308e84 (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 moved
-
uspace/lib/c/generic/loader.c (moved) (moved from uspace/lib/libc/generic/loader.c ) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/loader.c
rb50b5af2 r04803bf 33 33 */ 34 34 35 #include <ipc/ipc.h>36 35 #include <ipc/loader.h> 37 36 #include <ipc/services.h> 37 #include <ipc/ns.h> 38 38 #include <libc.h> 39 39 #include <task.h> 40 #include <str ing.h>40 #include <str.h> 41 41 #include <stdlib.h> 42 42 #include <async.h> … … 63 63 loader_t *loader_connect(void) 64 64 { 65 int phone_id = ipc_connect_me_to_blocking(PHONE_NS,SERVICE_LOAD, 0, 0);65 int phone_id = service_connect_blocking(SERVICE_LOAD, 0, 0); 66 66 if (phone_id < 0) 67 67 return NULL; … … 90 90 ipc_call_t answer; 91 91 aid_t req = async_send_0(ldr->phone_id, LOADER_GET_TASKID, &answer); 92 int rc = ipc_data_read_start(ldr->phone_id, task_id, sizeof(task_id_t)); 93 if (rc != EOK) { 94 async_wait_for(req, NULL); 95 return rc; 96 } 97 98 ipcarg_t retval; 92 int rc = async_data_read_start(ldr->phone_id, task_id, sizeof(task_id_t)); 93 if (rc != EOK) { 94 async_wait_for(req, NULL); 95 return rc; 96 } 97 98 sysarg_t retval; 99 async_wait_for(req, &retval); 100 return (int) retval; 101 } 102 103 /** Set current working directory for the loaded task. 104 * 105 * Sets the current working directory for the loaded task. 106 * 107 * @param ldr Loader connection structure. 108 * 109 * @return Zero on success or negative error code. 110 * 111 */ 112 int loader_set_cwd(loader_t *ldr) 113 { 114 char *cwd; 115 size_t len; 116 117 cwd = (char *) malloc(MAX_PATH_LEN + 1); 118 if (!cwd) 119 return ENOMEM; 120 if (!getcwd(cwd, MAX_PATH_LEN + 1)) 121 str_cpy(cwd, MAX_PATH_LEN + 1, "/"); 122 len = str_length(cwd); 123 124 ipc_call_t answer; 125 aid_t req = async_send_0(ldr->phone_id, LOADER_SET_CWD, &answer); 126 int rc = async_data_write_start(ldr->phone_id, cwd, len); 127 free(cwd); 128 if (rc != EOK) { 129 async_wait_for(req, NULL); 130 return rc; 131 } 132 133 sysarg_t retval; 99 134 async_wait_for(req, &retval); 100 135 return (int) retval; … … 123 158 ipc_call_t answer; 124 159 aid_t req = async_send_0(ldr->phone_id, LOADER_SET_PATHNAME, &answer); 125 int rc = ipc_data_write_start(ldr->phone_id, (void *) pa, pa_len); 126 if (rc != EOK) { 160 int rc = async_data_write_start(ldr->phone_id, (void *) pa, pa_len); 161 if (rc != EOK) { 162 free(pa); 127 163 async_wait_for(req, NULL); 128 164 return rc; … … 131 167 free(pa); 132 168 133 ipcarg_t retval;169 sysarg_t retval; 134 170 async_wait_for(req, &retval); 135 171 return (int) retval; … … 148 184 * 149 185 */ 150 int loader_set_args(loader_t *ldr, c har *const argv[])186 int loader_set_args(loader_t *ldr, const char *const argv[]) 151 187 { 152 188 /* … … 154 190 * compute size of the buffer needed. 155 191 */ 156 c har *const *ap = argv;192 const char *const *ap = argv; 157 193 size_t buffer_size = 0; 158 194 while (*ap != NULL) { … … 178 214 ipc_call_t answer; 179 215 aid_t req = async_send_0(ldr->phone_id, LOADER_SET_ARGS, &answer); 180 ipcarg_t rc = ipc_data_write_start(ldr->phone_id, (void *) arg_buf, buffer_size);216 sysarg_t rc = async_data_write_start(ldr->phone_id, (void *) arg_buf, buffer_size); 181 217 if (rc != EOK) { 182 218 async_wait_for(req, NULL); … … 232 268 ipc_call_t answer; 233 269 aid_t req = async_send_0(ldr->phone_id, LOADER_SET_FILES, &answer); 234 ipcarg_t rc = ipc_data_write_start(ldr->phone_id, (void *) files_buf,270 sysarg_t rc = async_data_write_start(ldr->phone_id, (void *) files_buf, 235 271 count * sizeof(fdi_node_t)); 236 272 if (rc != EOK) { … … 284 320 return rc; 285 321 286 ipc_hangup(ldr->phone_id);322 async_hangup(ldr->phone_id); 287 323 ldr->phone_id = 0; 288 324 return EOK; … … 302 338 void loader_abort(loader_t *ldr) 303 339 { 304 ipc_hangup(ldr->phone_id);340 async_hangup(ldr->phone_id); 305 341 ldr->phone_id = 0; 306 342 }
Note:
See TracChangeset
for help on using the changeset viewer.
