Changeset 7b616e2 in mainline for uspace/srv/ns/task.c
- Timestamp:
- 2017-09-27T22:40:09Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d076f16
- Parents:
- 8d6bcc8c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/ns/task.c
r8d6bcc8c r7b616e2 32 32 */ 33 33 34 #include <ipc/ipc.h>35 34 #include <adt/hash_table.h> 35 #include <async.h> 36 36 #include <stdbool.h> 37 37 #include <errno.h> … … 182 182 continue; 183 183 184 if (!(pr->callid & IPC_CALLID_NOTIFICATION)) { 185 texit = ht->have_rval ? TASK_EXIT_NORMAL : 186 TASK_EXIT_UNEXPECTED; 187 ipc_answer_2(pr->callid, EOK, texit, 188 ht->retval); 189 } 184 texit = ht->have_rval ? TASK_EXIT_NORMAL : 185 TASK_EXIT_UNEXPECTED; 186 async_answer_2(pr->callid, EOK, texit, ht->retval); 190 187 191 188 list_remove(&pr->link); … … 203 200 if (ht == NULL) { 204 201 /* No such task exists. */ 205 ipc_answer_0(callid, ENOENT);202 async_answer_0(callid, ENOENT); 206 203 return; 207 204 } … … 210 207 task_exit_t texit = ht->have_rval ? TASK_EXIT_NORMAL : 211 208 TASK_EXIT_UNEXPECTED; 212 ipc_answer_2(callid, EOK, texit, ht->retval);209 async_answer_2(callid, EOK, texit, ht->retval); 213 210 return; 214 211 } … … 218 215 (pending_wait_t *) malloc(sizeof(pending_wait_t)); 219 216 if (!pr) { 220 if (!(callid & IPC_CALLID_NOTIFICATION)) 221 ipc_answer_0(callid, ENOMEM); 217 async_answer_0(callid, ENOMEM); 222 218 return; 223 219 } … … 282 278 int ns_task_retval(ipc_call_t *call) 283 279 { 280 task_id_t id = call->in_task_id; 281 282 ht_link_t *link = hash_table_find(&task_hash_table, &id); 283 hashed_task_t *ht = (link != NULL) ? 284 hash_table_get_inst(link, hashed_task_t, link) : NULL; 285 286 if ((ht == NULL) || (ht->finished)) 287 return EINVAL; 288 289 ht->finished = true; 290 ht->have_rval = true; 291 ht->retval = IPC_GET_ARG1(*call); 292 293 process_pending_wait(); 294 295 return EOK; 296 } 297 298 int ns_task_disconnect(ipc_call_t *call) 299 { 284 300 task_id_t id; 285 301 int rc = get_id_by_phone(call->in_phone_hash, &id); … … 287 303 return rc; 288 304 289 ht_link_t *link = hash_table_find(&task_hash_table, &id);290 hashed_task_t *ht = (link != NULL) ?291 hash_table_get_inst(link, hashed_task_t, link) : NULL;292 293 if ((ht == NULL) || (ht->finished))294 return EINVAL;295 296 ht->finished = true;297 ht->have_rval = true;298 ht->retval = IPC_GET_ARG1(*call);299 300 process_pending_wait();301 302 return EOK;303 }304 305 int ns_task_disconnect(ipc_call_t *call)306 {307 task_id_t id;308 int rc = get_id_by_phone(call->in_phone_hash, &id);309 if (rc != EOK)310 return rc;311 312 305 /* Delete from phone-to-id map. */ 313 306 hash_table_remove(&phone_to_id, &call->in_phone_hash);
Note:
See TracChangeset
for help on using the changeset viewer.