Changeset 7114d83 in mainline
- Timestamp:
- 2009-07-06T16:02:27Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d96851
- Parents:
- d68e4d5
- Location:
- uspace
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/exec.c
rd68e4d5 r7114d83 114 114 task_id_t tid; 115 115 char *tmp; 116 int retval; 116 117 117 118 tmp = str_dup(find_command(cmd)); … … 126 127 } 127 128 128 task_wait(tid); 129 task_wait(tid, &retval); 130 if (retval != 0) 131 printf("Command failed (return value %d).\n", retval); 132 129 133 return 0; 130 134 } -
uspace/app/getvc/getvc.c
rd68e4d5 r7114d83 74 74 int main(int argc, char *argv[]) 75 75 { 76 int retval; 77 76 78 if (argc < 3) { 77 79 usage(); … … 98 100 version_print(argv[1]); 99 101 task_id_t id = spawn(argv[2]); 100 task_wait(id );102 task_wait(id, &retval); 101 103 102 104 return 0; -
uspace/lib/libc/generic/libc.c
rd68e4d5 r7114d83 62 62 void __main(void *pcb_ptr) 63 63 { 64 int retval; 65 64 66 __heap_init(); 65 67 __async_init(); … … 83 85 } 84 86 85 main(argc, argv); 87 retval = main(argc, argv); 88 86 89 __stdio_done(); 90 (void) task_retval(retval); 87 91 } 88 92 -
uspace/lib/libc/generic/task.c
rd68e4d5 r7114d83 149 149 } 150 150 151 int task_wait(task_id_t id )151 int task_wait(task_id_t id, int *retval) 152 152 { 153 return (int) async_req_2_0(PHONE_NS, NS_TASK_WAIT, LOWER32(id), UPPER32(id)); 153 ipcarg_t rv; 154 int rc; 155 156 rc = (int) async_req_2_1(PHONE_NS, NS_TASK_WAIT, LOWER32(id), 157 UPPER32(id), &rv); 158 *retval = rv; 159 160 return rc; 161 } 162 163 int task_retval(int val) 164 { 165 task_id_t id; 166 167 id = task_get_id(); 168 return (int) async_req_3_0(PHONE_NS, NS_RETVAL, LOWER32(id), 169 UPPER32(id), val); 154 170 } 155 171 -
uspace/lib/libc/include/ipc/ns.h
rd68e4d5 r7114d83 40 40 typedef enum { 41 41 NS_PING = IPC_FIRST_USER_METHOD, 42 NS_TASK_WAIT 42 NS_TASK_WAIT, 43 NS_RETVAL 43 44 } ns_request_t; 44 45 -
uspace/lib/libc/include/task.h
rd68e4d5 r7114d83 43 43 extern int task_set_name(const char *name); 44 44 extern task_id_t task_spawn(const char *path, char *const argv[]); 45 extern int task_wait(task_id_t id); 45 extern int task_wait(task_id_t id, int *retval); 46 extern int task_retval(int val); 47 46 48 47 49 #endif -
uspace/srv/ns/ns.c
rd68e4d5 r7114d83 171 171 wait_for_task(id, &call, callid); 172 172 continue; 173 case NS_RETVAL: 174 retval = ns_task_retval(&call); 175 break; 173 176 default: 174 177 retval = ENOENT; -
uspace/srv/ns/task.c
rd68e4d5 r7114d83 64 64 link_t link; 65 65 task_id_t id; /**< Task ID. */ 66 int retval; 66 67 bool destroyed; 67 68 } hashed_task_t; … … 174 175 175 176 if (!(pr->callid & IPC_CALLID_NOTIFICATION)) 176 ipc_answer_ 0(pr->callid, EOK);177 ipc_answer_1(pr->callid, EOK, ht->retval); 177 178 178 179 hash_table_remove(&task_hash_table, keys, 2); … … 222 223 ht->id = id; 223 224 ht->destroyed = (et == TASK_CREATE) ? false : true; 225 ht->retval = -1; 224 226 hash_table_insert(&task_hash_table, keys, &ht->link); 225 227 } else { … … 262 264 out: 263 265 if (!(callid & IPC_CALLID_NOTIFICATION)) 264 ipc_answer_0(callid, retval); 266 ipc_answer_1(callid, retval, ht->retval); 267 } 268 269 int ns_task_retval(ipc_call_t *call) 270 { 271 task_id_t id; 272 unsigned long keys[2]; 273 274 id = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call)); 275 276 keys[0] = LOWER32(id); 277 keys[1] = UPPER32(id); 278 279 link_t *link = hash_table_find(&task_hash_table, keys); 280 hashed_task_t *ht = (link != NULL) ? 281 hash_table_get_instance(link, hashed_task_t, link) : NULL; 282 283 if ((ht == NULL) || ht->destroyed) 284 return EINVAL; 285 286 ht->retval = IPC_GET_ARG3(*call); 287 288 return EOK; 265 289 } 266 290 -
uspace/srv/ns/task.h
rd68e4d5 r7114d83 43 43 extern void wait_for_task(task_id_t id, ipc_call_t *call, ipc_callid_t callid); 44 44 45 extern int ns_task_retval(ipc_call_t *call); 46 45 47 #endif 46 48
Note:
See TracChangeset
for help on using the changeset viewer.