Changes in uspace/srv/loader/main.c [5d96851:622cdbe] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loader/main.c
r5d96851 r622cdbe 72 72 static pcb_t pcb; 73 73 74 /** Current working directory */ 75 static char *cwd = NULL; 76 74 77 /** Number of arguments */ 75 78 static int argc = 0; … … 102 105 task_id = task_get_id(); 103 106 104 if (! ipc_data_read_receive(&callid, &len)) {107 if (!async_data_read_receive(&callid, &len)) { 105 108 ipc_answer_0(callid, EINVAL); 106 109 ipc_answer_0(rid, EINVAL); … … 111 114 len = sizeof(task_id); 112 115 113 ipc_data_read_finalize(callid, &task_id, len);116 async_data_read_finalize(callid, &task_id, len); 114 117 ipc_answer_0(rid, EOK); 115 118 } 116 119 120 /** Receive a call setting the current working directory. 121 * 122 * @param rid 123 * @param request 124 */ 125 static void ldr_set_cwd(ipc_callid_t rid, ipc_call_t *request) 126 { 127 ipc_callid_t callid; 128 size_t len; 129 130 if (!async_data_write_receive(&callid, &len)) { 131 ipc_answer_0(callid, EINVAL); 132 ipc_answer_0(rid, EINVAL); 133 return; 134 } 135 136 cwd = malloc(len + 1); 137 if (!cwd) { 138 ipc_answer_0(callid, ENOMEM); 139 ipc_answer_0(rid, ENOMEM); 140 return; 141 } 142 143 async_data_write_finalize(callid, cwd, len); 144 cwd[len] = '\0'; 145 146 ipc_answer_0(rid, EOK); 147 } 117 148 118 149 /** Receive a call setting pathname of the program to execute. … … 127 158 char *name_buf; 128 159 129 if (! ipc_data_write_receive(&callid, &len)) {160 if (!async_data_write_receive(&callid, &len)) { 130 161 ipc_answer_0(callid, EINVAL); 131 162 ipc_answer_0(rid, EINVAL); … … 140 171 } 141 172 142 ipc_data_write_finalize(callid, name_buf, len);173 async_data_write_finalize(callid, name_buf, len); 143 174 ipc_answer_0(rid, EOK); 144 175 … … 164 195 int n; 165 196 166 if (! ipc_data_write_receive(&callid, &buf_size)) {197 if (!async_data_write_receive(&callid, &buf_size)) { 167 198 ipc_answer_0(callid, EINVAL); 168 199 ipc_answer_0(rid, EINVAL); … … 187 218 } 188 219 189 ipc_data_write_finalize(callid, arg_buf, buf_size);220 async_data_write_finalize(callid, arg_buf, buf_size); 190 221 191 222 arg_buf[buf_size] = '\0'; … … 239 270 ipc_callid_t callid; 240 271 size_t buf_size; 241 if (! ipc_data_write_receive(&callid, &buf_size)) {272 if (!async_data_write_receive(&callid, &buf_size)) { 242 273 ipc_answer_0(callid, EINVAL); 243 274 ipc_answer_0(rid, EINVAL); … … 268 299 } 269 300 270 ipc_data_write_finalize(callid, fil_buf, buf_size);301 async_data_write_finalize(callid, fil_buf, buf_size); 271 302 272 303 int count = buf_size / sizeof(fdi_node_t); … … 312 343 313 344 elf_create_pcb(&prog_info, &pcb); 345 346 pcb.cwd = cwd; 314 347 315 348 pcb.argc = argc; … … 406 439 case LOADER_GET_TASKID: 407 440 ldr_get_taskid(callid, &call); 441 continue; 442 case LOADER_SET_CWD: 443 ldr_set_cwd(callid, &call); 408 444 continue; 409 445 case LOADER_SET_PATHNAME:
Note:
See TracChangeset
for help on using the changeset viewer.