Changes in uspace/lib/c/generic/async.c [4d6629f:503ffce] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async.c
r4d6629f r503ffce 106 106 #include <fibril.h> 107 107 #include <adt/hash_table.h> 108 #include <adt/hash.h> 108 109 #include <adt/list.h> 109 110 #include <assert.h> … … 587 588 }; 588 589 589 /** Compute hash into the connection hash table based on the source phone hash. 590 * 591 * @param key Pointer to source phone hash. 590 typedef struct { 591 task_id_t task_id; 592 sysarg_t phone_hash; 593 } conn_key_t; 594 595 /** Compute hash into the connection hash table 596 * 597 * The hash is based on the source task ID and the source phone hash. The task 598 * ID is included in the hash because a phone hash alone might not be unique 599 * while we still track connections for killed tasks due to kernel's recycling 600 * of phone structures. 601 * 602 * @param key Pointer to the connection key structure. 592 603 * 593 604 * @return Index into the connection hash table. … … 596 607 static size_t conn_key_hash(void *key) 597 608 { 598 sysarg_t in_phone_hash = *(sysarg_t *) key; 599 return in_phone_hash; 609 conn_key_t *ck = (conn_key_t *) key; 610 611 size_t hash = 0; 612 hash = hash_combine(hash, LOWER32(ck->task_id)); 613 hash = hash_combine(hash, UPPER32(ck->task_id)); 614 hash = hash_combine(hash, ck->phone_hash); 615 return hash; 600 616 } 601 617 … … 603 619 { 604 620 connection_t *conn = hash_table_get_inst(item, connection_t, link); 605 return conn_key_hash(&conn->in_phone_hash); 621 return conn_key_hash(&(conn_key_t){ 622 .task_id = conn->in_task_id, 623 .phone_hash = conn->in_phone_hash 624 }); 606 625 } 607 626 608 627 static bool conn_key_equal(void *key, const ht_link_t *item) 609 628 { 610 sysarg_t in_phone_hash = *(sysarg_t *) key;629 conn_key_t *ck = (conn_key_t *) key; 611 630 connection_t *conn = hash_table_get_inst(item, connection_t, link); 612 return (in_phone_hash == conn->in_phone_hash); 631 return ((ck->task_id == conn->in_task_id) && 632 (ck->phone_hash == conn->in_phone_hash)); 613 633 } 614 634 … … 716 736 */ 717 737 futex_down(&async_futex); 718 hash_table_remove(&conn_hash_table, &fibril_connection->in_phone_hash); 738 hash_table_remove(&conn_hash_table, &(conn_key_t){ 739 .task_id = fibril_connection->in_task_id, 740 .phone_hash = fibril_connection->in_phone_hash 741 }); 719 742 futex_up(&async_futex); 720 743 … … 951 974 futex_down(&async_futex); 952 975 953 ht_link_t *link = hash_table_find(&conn_hash_table, &call->in_phone_hash); 976 ht_link_t *link = hash_table_find(&conn_hash_table, &(conn_key_t){ 977 .task_id = call->in_task_id, 978 .phone_hash = call->in_phone_hash 979 }); 954 980 if (!link) { 955 981 futex_up(&async_futex); … … 1315 1341 1316 1342 /* Kernel notification */ 1317 if ( (callid & IPC_CALLID_NOTIFICATION)) {1343 if (call->flags & IPC_CALLID_NOTIFICATION) { 1318 1344 fibril_t *fibril = (fibril_t *) __tcb_get()->fibril_data; 1319 1345 unsigned oldsw = fibril->switches; … … 1469 1495 } 1470 1496 1471 if (call id& IPC_CALLID_ANSWERED)1497 if (call.flags & IPC_CALLID_ANSWERED) 1472 1498 continue; 1473 1499
Note:
See TracChangeset
for help on using the changeset viewer.