Changes in uspace/lib/c/generic/async.c [4d6629f:6a5d05b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async.c
r4d6629f r6a5d05b 77 77 * } 78 78 * 79 * port_handler(ic allid, *icall)79 * port_handler(ichandle, *icall) 80 80 * { 81 81 * if (want_refuse) { 82 * async_answer_0(ic allid, ELIMIT);82 * async_answer_0(ichandle, ELIMIT); 83 83 * return; 84 84 * } 85 * async_answer_0(ic allid, EOK);86 * 87 * c allid= async_get_call(&call);88 * somehow_handle_the_call(c allid, call);89 * async_answer_2(c allid, 1, 2, 3);90 * 91 * c allid= async_get_call(&call);85 * async_answer_0(ichandle, EOK); 86 * 87 * chandle = async_get_call(&call); 88 * somehow_handle_the_call(chandle, call); 89 * async_answer_2(chandle, 1, 2, 3); 90 * 91 * chandle = async_get_call(&call); 92 92 * ... 93 93 * } … … 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> … … 112 113 #include <libarch/barrier.h> 113 114 #include <stdbool.h> 114 #include < malloc.h>115 #include <stdlib.h> 115 116 #include <mem.h> 116 117 #include <stdlib.h> … … 184 185 link_t link; 185 186 186 ipc_callid_t callid;187 cap_handle_t chandle; 187 188 ipc_call_t call; 188 189 } msg_t; … … 204 205 ipc_call_t *dataptr; 205 206 206 sysarg_t retval;207 int retval; 207 208 } amsg_t; 208 209 … … 236 237 237 238 /** Identification of the opening call. */ 238 ipc_callid_t callid;239 cap_handle_t chandle; 239 240 240 241 /** Call data of the opening call. */ … … 242 243 243 244 /** Identification of the closing call. */ 244 ipc_callid_t close_callid;245 cap_handle_t close_chandle; 245 246 246 247 /** Fibril function that will be used to handle the connection. */ … … 331 332 msg->destroyed = false; 332 333 msg->dataptr = NULL; 333 msg->retval = (sysarg_t)EINVAL;334 msg->retval = EINVAL; 334 335 awaiter_initialize(&msg->wdata); 335 336 } … … 373 374 /** Default fallback fibril function. 374 375 * 375 * This fallback fibril function gets called on incomming 376 * connections that donot have a specific handler defined.377 * 378 * @param c allid Hashof the incoming call.379 * @param call Data of the incoming call.380 * @param arg Local argument381 * 382 */ 383 static void default_fallback_port_handler( ipc_callid_t callid, ipc_call_t *call,384 void *arg)385 { 386 ipc_answer_0(c allid, ENOENT);376 * This fallback fibril function gets called on incomming connections that do 377 * not have a specific handler defined. 378 * 379 * @param chandle Handle of the incoming call. 380 * @param call Data of the incoming call. 381 * @param arg Local argument 382 * 383 */ 384 static void default_fallback_port_handler(cap_handle_t chandle, 385 ipc_call_t *call, void *arg) 386 { 387 ipc_answer_0(chandle, ENOENT); 387 388 } 388 389 … … 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 … … 695 715 client_t *client = async_client_get(fibril_connection->in_task_id, true); 696 716 if (!client) { 697 ipc_answer_0(fibril_connection->c allid, ENOMEM);717 ipc_answer_0(fibril_connection->chandle, ENOMEM); 698 718 return 0; 699 719 } … … 704 724 * Call the connection handler function. 705 725 */ 706 fibril_connection->handler(fibril_connection->c allid,726 fibril_connection->handler(fibril_connection->chandle, 707 727 &fibril_connection->call, fibril_connection->data); 708 728 … … 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 … … 728 751 729 752 list_remove(&msg->link); 730 ipc_answer_0(msg->c allid, EHANGUP);753 ipc_answer_0(msg->chandle, EHANGUP); 731 754 free(msg); 732 755 } … … 736 759 * i.e. IPC_M_PHONE_HUNGUP. 737 760 */ 738 if (fibril_connection->close_c allid)739 ipc_answer_0(fibril_connection->close_c allid, EOK);761 if (fibril_connection->close_chandle) 762 ipc_answer_0(fibril_connection->close_chandle, EOK); 740 763 741 764 free(fibril_connection); 742 return 0;765 return EOK; 743 766 } 744 767 745 768 /** Create a new fibril for a new connection. 746 769 * 747 * Create new fibril for connection, fill in connection structures 748 * and insert it into the hash table, so that later we can easily749 * do routing of messages toparticular fibrils.750 * 751 * @param in_task_id Identification of the incoming connection.752 * @param in_phone_hash Identification of the incoming connection.753 * @param c allid Hashof the opening IPC_M_CONNECT_ME_TO call.754 * If callid is zero, the connection was opened by755 * accepting the IPC_M_CONNECT_TO_ME call and this756 * function is called directly by the server.757 * @param call Call data of the opening call.758 * @param handler Connection handler.759 * @param data Client argument to pass to the connection handler.760 * 761 * @return New fibril id or NULL on failure.770 * Create new fibril for connection, fill in connection structures and insert it 771 * into the hash table, so that later we can easily do routing of messages to 772 * particular fibrils. 773 * 774 * @param in_task_id Identification of the incoming connection. 775 * @param in_phone_hash Identification of the incoming connection. 776 * @param chandle Handle of the opening IPC_M_CONNECT_ME_TO call. 777 * If chandle is CAP_NIL, the connection was opened by 778 * accepting the IPC_M_CONNECT_TO_ME call and this 779 * function is called directly by the server. 780 * @param call Call data of the opening call. 781 * @param handler Connection handler. 782 * @param data Client argument to pass to the connection handler. 783 * 784 * @return New fibril id or NULL on failure. 762 785 * 763 786 */ 764 787 static fid_t async_new_connection(task_id_t in_task_id, sysarg_t in_phone_hash, 765 ipc_callid_t callid, ipc_call_t *call, async_port_handler_t handler,788 cap_handle_t chandle, ipc_call_t *call, async_port_handler_t handler, 766 789 void *data) 767 790 { 768 791 connection_t *conn = malloc(sizeof(*conn)); 769 792 if (!conn) { 770 if (c allid)771 ipc_answer_0(c allid, ENOMEM);793 if (chandle != CAP_NIL) 794 ipc_answer_0(chandle, ENOMEM); 772 795 773 796 return (uintptr_t) NULL; … … 777 800 conn->in_phone_hash = in_phone_hash; 778 801 list_initialize(&conn->msg_queue); 779 conn->c allid = callid;780 conn->close_c allid = 0;802 conn->chandle = chandle; 803 conn->close_chandle = CAP_NIL; 781 804 conn->handler = handler; 782 805 conn->data = data; … … 792 815 free(conn); 793 816 794 if (c allid)795 ipc_answer_0(c allid, ENOMEM);817 if (chandle != CAP_NIL) 818 ipc_answer_0(chandle, ENOMEM); 796 819 797 820 return (uintptr_t) NULL; … … 821 844 * @param port_id ID of the newly created port. 822 845 * 823 * @return Zero on success or a negativeerror code.846 * @return Zero on success or an error code. 824 847 * 825 848 */ … … 837 860 &answer); 838 861 839 sysarg_t ret;862 int ret; 840 863 async_wait_for(req, &ret); 841 864 if (ret != EOK) … … 869 892 870 893 fid_t fid = async_new_connection(answer.in_task_id, phone_hash, 871 0, NULL, handler, data);894 CAP_NIL, NULL, handler, data); 872 895 if (fid == (uintptr_t) NULL) 873 896 return ENOMEM; … … 938 961 * timeouts are unregistered. 939 962 * 940 * @param c allid Hashof the incoming call.941 * @param call Data of the incoming call.963 * @param chandle Handle of the incoming call. 964 * @param call Data of the incoming call. 942 965 * 943 966 * @return False if the call doesn't match any connection. … … 945 968 * 946 969 */ 947 static bool route_call( ipc_callid_t callid, ipc_call_t *call)970 static bool route_call(cap_handle_t chandle, ipc_call_t *call) 948 971 { 949 972 assert(call); … … 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); … … 965 991 } 966 992 967 msg->c allid = callid;993 msg->chandle = chandle; 968 994 msg->call = *call; 969 995 list_append(&msg->link, &conn->msg_queue); 970 996 971 997 if (IPC_GET_IMETHOD(*call) == IPC_M_PHONE_HUNGUP) 972 conn->close_c allid = callid;998 conn->close_chandle = chandle; 973 999 974 1000 /* If the connection fibril is waiting for an event, activate it */ … … 991 1017 /** Process notification. 992 1018 * 993 * @param callid Hash of the incoming call.994 1019 * @param call Data of the incoming call. 995 1020 * 996 1021 */ 997 static void process_notification(ipc_call id_t callid, ipc_call_t *call)1022 static void process_notification(ipc_call_t *call) 998 1023 { 999 1024 async_notification_handler_t handler = NULL; … … 1016 1041 1017 1042 if (handler) 1018 handler(call id, call, data);1043 handler(call, data); 1019 1044 } 1020 1045 … … 1026 1051 * @param ucode Top-half pseudocode handler. 1027 1052 * 1028 * @return IRQ capability handle on success. 1029 * @return Negative error code. 1053 * @param[out] handle IRQ capability handle on success. 1054 * 1055 * @return An error code. 1030 1056 * 1031 1057 */ 1032 1058 int async_irq_subscribe(int inr, async_notification_handler_t handler, 1033 void *data, const irq_code_t *ucode )1059 void *data, const irq_code_t *ucode, cap_handle_t *handle) 1034 1060 { 1035 1061 notification_t *notification = … … 1051 1077 futex_up(&async_futex); 1052 1078 1053 return ipc_irq_subscribe(inr, imethod, ucode); 1079 cap_handle_t cap; 1080 int rc = ipc_irq_subscribe(inr, imethod, ucode, &cap); 1081 if (rc == EOK && handle != NULL) { 1082 *handle = cap; 1083 } 1084 return rc; 1054 1085 } 1055 1086 … … 1058 1089 * @param cap IRQ capability handle. 1059 1090 * 1060 * @return Zero on success or a negativeerror code.1091 * @return Zero on success or an error code. 1061 1092 * 1062 1093 */ … … 1075 1106 * @param data Notification handler client data. 1076 1107 * 1077 * @return Zero on success or a negativeerror code.1108 * @return Zero on success or an error code. 1078 1109 * 1079 1110 */ … … 1108 1139 * @param data Notification handler client data. 1109 1140 * 1110 * @return Zero on success or a negativeerror code.1141 * @return Zero on success or an error code. 1111 1142 * 1112 1143 */ … … 1161 1192 /** Return new incoming message for the current (fibril-local) connection. 1162 1193 * 1163 * @param call Storage where the incoming call data will be stored. 1164 * @param usecs Timeout in microseconds. Zero denotes no timeout. 1165 * 1166 * @return If no timeout was specified, then a hash of the 1167 * incoming call is returned. If a timeout is specified, 1168 * then a hash of the incoming call is returned unless 1169 * the timeout expires prior to receiving a message. In 1170 * that case zero is returned. 1171 * 1172 */ 1173 ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs) 1194 * @param call Storage where the incoming call data will be stored. 1195 * @param usecs Timeout in microseconds. Zero denotes no timeout. 1196 * 1197 * @return If no timeout was specified, then a handle of the incoming call is 1198 * returned. If a timeout is specified, then a handle of the incoming 1199 * call is returned unless the timeout expires prior to receiving a 1200 * message. In that case zero CAP_NIL is returned. 1201 */ 1202 cap_handle_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs) 1174 1203 { 1175 1204 assert(call); … … 1194 1223 /* If nothing in queue, wait until something arrives */ 1195 1224 while (list_empty(&conn->msg_queue)) { 1196 if (conn->close_c allid) {1225 if (conn->close_chandle) { 1197 1226 /* 1198 1227 * Handle the case when the connection was already … … 1205 1234 IPC_SET_IMETHOD(*call, IPC_M_PHONE_HUNGUP); 1206 1235 futex_up(&async_futex); 1207 return conn->close_c allid;1236 return conn->close_chandle; 1208 1237 } 1209 1238 … … 1230 1259 /* If we timed out -> exit */ 1231 1260 futex_up(&async_futex); 1232 return 0;1261 return CAP_NIL; 1233 1262 } 1234 1263 } … … 1238 1267 list_remove(&msg->link); 1239 1268 1240 ipc_callid_t callid = msg->callid;1269 cap_handle_t chandle = msg->chandle; 1241 1270 *call = msg->call; 1242 1271 free(msg); 1243 1272 1244 1273 futex_up(&async_futex); 1245 return c allid;1274 return chandle; 1246 1275 } 1247 1276 … … 1306 1335 * Otherwise the call is routed to its connection fibril. 1307 1336 * 1308 * @param c allid Hashof the incoming call.1309 * @param call Data of the incoming call.1310 * 1311 */ 1312 static void handle_call( ipc_callid_t callid, ipc_call_t *call)1337 * @param chandle Handle of the incoming call. 1338 * @param call Data of the incoming call. 1339 * 1340 */ 1341 static void handle_call(cap_handle_t chandle, ipc_call_t *call) 1313 1342 { 1314 1343 assert(call); 1315 1344 1316 1345 /* Kernel notification */ 1317 if ((c allid & IPC_CALLID_NOTIFICATION)) {1346 if ((chandle == CAP_NIL) && (call->flags & IPC_CALL_NOTIF)) { 1318 1347 fibril_t *fibril = (fibril_t *) __tcb_get()->fibril_data; 1319 1348 unsigned oldsw = fibril->switches; 1320 1349 1321 process_notification(call id, call);1350 process_notification(call); 1322 1351 1323 1352 if (oldsw != fibril->switches) { … … 1345 1374 sysarg_t in_phone_hash = IPC_GET_ARG5(*call); 1346 1375 1347 async_ notification_handler_t handler = fallback_port_handler;1376 async_port_handler_t handler = fallback_port_handler; 1348 1377 void *data = fallback_port_data; 1349 1378 … … 1355 1384 } 1356 1385 1357 async_new_connection(call->in_task_id, in_phone_hash, c allid,1386 async_new_connection(call->in_task_id, in_phone_hash, chandle, 1358 1387 call, handler, data); 1359 1388 return; … … 1361 1390 1362 1391 /* Try to route the call through the connection hash table */ 1363 if (route_call(c allid, call))1392 if (route_call(chandle, call)) 1364 1393 return; 1365 1394 1366 1395 /* Unknown call from unknown phone - hang it up */ 1367 ipc_answer_0(c allid, EHANGUP);1396 ipc_answer_0(chandle, EHANGUP); 1368 1397 } 1369 1398 … … 1460 1489 1461 1490 ipc_call_t call; 1462 i pc_callid_t callid= ipc_wait_cycle(&call, timeout, flags);1491 int rc = ipc_wait_cycle(&call, timeout, flags); 1463 1492 1464 1493 atomic_dec(&threads_in_ipc_wait); 1465 1494 1466 if (!callid) { 1467 handle_expired_timeouts(); 1495 assert(rc == EOK); 1496 1497 if (call.cap_handle == CAP_NIL) { 1498 if ((call.flags & 1499 (IPC_CALL_NOTIF | IPC_CALL_ANSWERED)) == 0) { 1500 /* Neither a notification nor an answer. */ 1501 handle_expired_timeouts(); 1502 continue; 1503 } 1504 } 1505 1506 if (call.flags & IPC_CALL_ANSWERED) 1468 1507 continue; 1469 } 1470 1471 if (callid & IPC_CALLID_ANSWERED) 1472 continue; 1473 1474 handle_call(callid, &call); 1475 } 1476 1508 1509 handle_call(call.cap_handle, &call); 1510 } 1511 1477 1512 return 0; 1478 1513 } … … 1605 1640 * @param arg3 Service-defined payload argument. 1606 1641 * @param arg4 Service-defined payload argument. 1607 * @param dataptr If non-NULL, storage where the reply data will be 1608 * stored. 1642 * @param dataptr If non-NULL, storage where the reply data will be stored. 1609 1643 * 1610 1644 * @return Hash of the sent message or 0 on error. … … 1675 1709 * 1676 1710 */ 1677 void async_wait_for(aid_t amsgid, sysarg_t *retval)1711 void async_wait_for(aid_t amsgid, int *retval) 1678 1712 { 1679 1713 assert(amsgid); … … 1721 1755 * 1722 1756 */ 1723 int async_wait_timeout(aid_t amsgid, sysarg_t *retval, suseconds_t timeout)1757 int async_wait_timeout(aid_t amsgid, int *retval, suseconds_t timeout) 1724 1758 { 1725 1759 assert(amsgid); … … 1822 1856 void async_usleep(suseconds_t timeout) 1823 1857 { 1824 amsg_t *msg = amsg_create(); 1825 if (!msg) 1826 return; 1827 1828 msg->wdata.fid = fibril_get_id(); 1829 1830 getuptime(&msg->wdata.to_event.expires); 1831 tv_add_diff(&msg->wdata.to_event.expires, timeout); 1858 awaiter_t awaiter; 1859 awaiter_initialize(&awaiter); 1860 1861 awaiter.fid = fibril_get_id(); 1862 1863 getuptime(&awaiter.to_event.expires); 1864 tv_add_diff(&awaiter.to_event.expires, timeout); 1832 1865 1833 1866 futex_down(&async_futex); 1834 1867 1835 async_insert_timeout(& msg->wdata);1868 async_insert_timeout(&awaiter); 1836 1869 1837 1870 /* Leave the async_futex locked when entering this function */ … … 1839 1872 1840 1873 /* Futex is up automatically after fibril_switch() */ 1841 1842 amsg_destroy(msg); 1874 } 1875 1876 /** Delay execution for the specified number of seconds 1877 * 1878 * @param sec Number of seconds to sleep 1879 */ 1880 void async_sleep(unsigned int sec) 1881 { 1882 /* 1883 * Sleep in 1000 second steps to support 1884 * full argument range 1885 */ 1886 1887 while (sec > 0) { 1888 unsigned int period = (sec > 1000) ? 1000 : sec; 1889 1890 async_usleep(period * 1000000); 1891 sec -= period; 1892 } 1843 1893 } 1844 1894 … … 1862 1912 * @param r5 If non-NULL, storage for the 5th reply argument. 1863 1913 * 1864 * @return Return code of the reply or a negativeerror code.1865 * 1866 */ 1867 sysarg_t async_req_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,1914 * @return Return code of the reply or an error code. 1915 * 1916 */ 1917 int async_req_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1, 1868 1918 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2, 1869 1919 sysarg_t *r3, sysarg_t *r4, sysarg_t *r5) … … 1876 1926 &result); 1877 1927 1878 sysarg_t rc;1928 int rc; 1879 1929 async_wait_for(aid, &rc); 1880 1930 … … 1914 1964 * @param r5 If non-NULL, storage for the 5th reply argument. 1915 1965 * 1916 * @return Return code of the reply or a negativeerror code.1917 * 1918 */ 1919 sysarg_t async_req_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,1966 * @return Return code of the reply or an error code. 1967 * 1968 */ 1969 int async_req_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1, 1920 1970 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1, 1921 1971 sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5) … … 1928 1978 &result); 1929 1979 1930 sysarg_t rc;1980 int rc; 1931 1981 async_wait_for(aid, &rc); 1932 1982 … … 1992 2042 } 1993 2043 1994 sysarg_t async_answer_0(ipc_callid_t callid, sysarg_t retval)1995 { 1996 return ipc_answer_0(c allid, retval);1997 } 1998 1999 sysarg_t async_answer_1(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1)2000 { 2001 return ipc_answer_1(c allid, retval, arg1);2002 } 2003 2004 sysarg_t async_answer_2(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,2044 int async_answer_0(cap_handle_t chandle, int retval) 2045 { 2046 return ipc_answer_0(chandle, retval); 2047 } 2048 2049 int async_answer_1(cap_handle_t chandle, int retval, sysarg_t arg1) 2050 { 2051 return ipc_answer_1(chandle, retval, arg1); 2052 } 2053 2054 int async_answer_2(cap_handle_t chandle, int retval, sysarg_t arg1, 2005 2055 sysarg_t arg2) 2006 2056 { 2007 return ipc_answer_2(c allid, retval, arg1, arg2);2008 } 2009 2010 sysarg_t async_answer_3(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,2057 return ipc_answer_2(chandle, retval, arg1, arg2); 2058 } 2059 2060 int async_answer_3(cap_handle_t chandle, int retval, sysarg_t arg1, 2011 2061 sysarg_t arg2, sysarg_t arg3) 2012 2062 { 2013 return ipc_answer_3(c allid, retval, arg1, arg2, arg3);2014 } 2015 2016 sysarg_t async_answer_4(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,2063 return ipc_answer_3(chandle, retval, arg1, arg2, arg3); 2064 } 2065 2066 int async_answer_4(cap_handle_t chandle, int retval, sysarg_t arg1, 2017 2067 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4) 2018 2068 { 2019 return ipc_answer_4(c allid, retval, arg1, arg2, arg3, arg4);2020 } 2021 2022 sysarg_t async_answer_5(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,2069 return ipc_answer_4(chandle, retval, arg1, arg2, arg3, arg4); 2070 } 2071 2072 int async_answer_5(cap_handle_t chandle, int retval, sysarg_t arg1, 2023 2073 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5) 2024 2074 { 2025 return ipc_answer_5(c allid, retval, arg1, arg2, arg3, arg4, arg5);2026 } 2027 2028 int async_forward_fast( ipc_callid_t callid, async_exch_t *exch,2075 return ipc_answer_5(chandle, retval, arg1, arg2, arg3, arg4, arg5); 2076 } 2077 2078 int async_forward_fast(cap_handle_t chandle, async_exch_t *exch, 2029 2079 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode) 2030 2080 { … … 2032 2082 return ENOENT; 2033 2083 2034 return ipc_forward_fast(c allid, exch->phone, imethod, arg1, arg2, mode);2035 } 2036 2037 int async_forward_slow( ipc_callid_t callid, async_exch_t *exch,2084 return ipc_forward_fast(chandle, exch->phone, imethod, arg1, arg2, mode); 2085 } 2086 2087 int async_forward_slow(cap_handle_t chandle, async_exch_t *exch, 2038 2088 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, 2039 2089 sysarg_t arg4, sysarg_t arg5, unsigned int mode) … … 2042 2092 return ENOENT; 2043 2093 2044 return ipc_forward_slow(c allid, exch->phone, imethod, arg1, arg2, arg3,2094 return ipc_forward_slow(chandle, exch->phone, imethod, arg1, arg2, arg3, 2045 2095 arg4, arg5, mode); 2046 2096 } … … 2055 2105 * @param arg3 User defined argument. 2056 2106 * 2057 * @return Zero on success or a negativeerror code.2107 * @return Zero on success or an error code. 2058 2108 * 2059 2109 */ … … 2068 2118 &answer); 2069 2119 2070 sysarg_t rc;2120 int rc; 2071 2121 async_wait_for(req, &rc); 2072 2122 if (rc != EOK) … … 2077 2127 2078 2128 static int async_connect_me_to_internal(int phone, sysarg_t arg1, sysarg_t arg2, 2079 sysarg_t arg3, sysarg_t arg4 )2129 sysarg_t arg3, sysarg_t arg4, int *out_phone) 2080 2130 { 2081 2131 ipc_call_t result; 2132 2133 // XXX: Workaround for GCC's inability to infer association between 2134 // rc == EOK and *out_phone being assigned. 2135 *out_phone = -1; 2082 2136 2083 2137 amsg_t *msg = amsg_create(); … … 2091 2145 msg, reply_received); 2092 2146 2093 sysarg_t rc;2147 int rc; 2094 2148 async_wait_for((aid_t) msg, &rc); 2095 2149 … … 2097 2151 return rc; 2098 2152 2099 return (int) IPC_GET_ARG5(result); 2153 *out_phone = (int) IPC_GET_ARG5(result); 2154 return EOK; 2100 2155 } 2101 2156 … … 2127 2182 } 2128 2183 2129 int phone = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3, 2130 0); 2131 if (phone < 0) { 2132 errno = phone; 2184 int phone; 2185 int rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3, 2186 0, &phone); 2187 if (rc != EOK) { 2188 errno = rc; 2133 2189 free(sess); 2134 2190 return NULL; … … 2179 2235 } 2180 2236 2181 int phone = async_connect_me_to_internal(exch->phone, iface, arg2, 2182 arg3, 0); 2183 if (phone < 0) { 2184 errno = phone; 2237 int phone; 2238 int rc = async_connect_me_to_internal(exch->phone, iface, arg2, 2239 arg3, 0, &phone); 2240 if (rc != EOK) { 2241 errno = rc; 2185 2242 free(sess); 2186 2243 return NULL; … … 2249 2306 } 2250 2307 2251 int phone = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3, 2252 IPC_FLAG_BLOCKING); 2253 2254 if (phone < 0) { 2255 errno = phone; 2308 int phone; 2309 int rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3, 2310 IPC_FLAG_BLOCKING, &phone); 2311 2312 if (rc != EOK) { 2313 errno = rc; 2256 2314 free(sess); 2257 2315 return NULL; … … 2302 2360 } 2303 2361 2304 int phone = async_connect_me_to_internal(exch->phone, iface, arg2, 2305 arg3, IPC_FLAG_BLOCKING); 2306 if (phone < 0) { 2307 errno = phone; 2362 int phone; 2363 int rc = async_connect_me_to_internal(exch->phone, iface, arg2, 2364 arg3, IPC_FLAG_BLOCKING, &phone); 2365 if (rc != EOK) { 2366 errno = rc; 2308 2367 free(sess); 2309 2368 return NULL; … … 2337 2396 } 2338 2397 2339 int phone = ipc_connect_kbox(id); 2340 if (phone < 0) { 2341 errno = phone; 2398 cap_handle_t phone; 2399 int rc = ipc_connect_kbox(id, &phone); 2400 if (rc != EOK) { 2401 errno = rc; 2342 2402 free(sess); 2343 2403 return NULL; … … 2370 2430 * @param sess Session to hung up. 2371 2431 * 2372 * @return Zero on success or a negativeerror code.2432 * @return Zero on success or an error code. 2373 2433 * 2374 2434 */ … … 2456 2516 } else if (mgmt == EXCHANGE_PARALLEL) { 2457 2517 int phone; 2518 int rc; 2458 2519 2459 2520 retry: … … 2461 2522 * Make a one-time attempt to connect a new data phone. 2462 2523 */ 2463 phone= async_connect_me_to_internal(sess->phone, sess->arg1,2464 sess->arg2, sess->arg3, 0 );2465 if ( phone >= 0) {2524 rc = async_connect_me_to_internal(sess->phone, sess->arg1, 2525 sess->arg2, sess->arg3, 0, &phone); 2526 if (rc == EOK) { 2466 2527 exch = (async_exch_t *) malloc(sizeof(async_exch_t)); 2467 2528 if (exch != NULL) { … … 2549 2610 * base address. Cannot be NULL. 2550 2611 * 2551 * @return Zero on success or a negativeerror code from errno.h.2612 * @return Zero on success or an error code from errno.h. 2552 2613 * 2553 2614 */ … … 2578 2639 * So far, this wrapper is to be used from within a connection fibril. 2579 2640 * 2580 * @param c allid Storage for the hashof the IPC_M_SHARE_IN call.2581 * @param size Destination address space area size.2641 * @param chandle Storage for the handle of the IPC_M_SHARE_IN call. 2642 * @param size Destination address space area size. 2582 2643 * 2583 2644 * @return True on success, false on failure. 2584 2645 * 2585 2646 */ 2586 bool async_share_in_receive( ipc_callid_t *callid, size_t *size)2587 { 2588 assert(c allid);2647 bool async_share_in_receive(cap_handle_t *chandle, size_t *size) 2648 { 2649 assert(chandle); 2589 2650 assert(size); 2590 2651 2591 2652 ipc_call_t data; 2592 *c allid= async_get_call(&data);2653 *chandle = async_get_call(&data); 2593 2654 2594 2655 if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_IN) … … 2605 2666 * argument. 2606 2667 * 2607 * @param c allid Hashof the IPC_M_DATA_READ call to answer.2608 * @param src Source address space base.2609 * @param flags Flags to be used for sharing. Bits can be only cleared.2668 * @param chandle Handle of the IPC_M_DATA_READ call to answer. 2669 * @param src Source address space base. 2670 * @param flags Flags to be used for sharing. Bits can be only cleared. 2610 2671 * 2611 2672 * @return Zero on success or a value from @ref errno.h on failure. 2612 2673 * 2613 2674 */ 2614 int async_share_in_finalize( ipc_callid_t callid, void *src, unsigned int flags)2615 { 2616 return ipc_answer_3(c allid, EOK, (sysarg_t) src, (sysarg_t) flags,2675 int async_share_in_finalize(cap_handle_t chandle, void *src, unsigned int flags) 2676 { 2677 return ipc_answer_3(chandle, EOK, (sysarg_t) src, (sysarg_t) flags, 2617 2678 (sysarg_t) __entry); 2618 2679 } … … 2624 2685 * @param flags Flags to be used for sharing. Bits can be only cleared. 2625 2686 * 2626 * @return Zero on success or a negativeerror code from errno.h.2687 * @return Zero on success or an error code from errno.h. 2627 2688 * 2628 2689 */ … … 2644 2705 * So far, this wrapper is to be used from within a connection fibril. 2645 2706 * 2646 * @param c allidStorage for the hash of the IPC_M_SHARE_OUT call.2647 * @param size Storage for the source address space area size.2648 * @param flags Storage for the sharing flags.2707 * @param chandle Storage for the hash of the IPC_M_SHARE_OUT call. 2708 * @param size Storage for the source address space area size. 2709 * @param flags Storage for the sharing flags. 2649 2710 * 2650 2711 * @return True on success, false on failure. 2651 2712 * 2652 2713 */ 2653 bool async_share_out_receive(ipc_callid_t *callid, size_t *size, unsigned int *flags) 2654 { 2655 assert(callid); 2714 bool async_share_out_receive(cap_handle_t *chandle, size_t *size, 2715 unsigned int *flags) 2716 { 2717 assert(chandle); 2656 2718 assert(size); 2657 2719 assert(flags); 2658 2720 2659 2721 ipc_call_t data; 2660 *c allid= async_get_call(&data);2722 *chandle = async_get_call(&data); 2661 2723 2662 2724 if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_OUT) … … 2674 2736 * argument. 2675 2737 * 2676 * @param c allid Hashof the IPC_M_DATA_WRITE call to answer.2677 * @param dst Address of the storage for the destination address space area2678 * base address.2679 * 2680 * @return Zero on success or a value from @ref errno.h on failure.2681 * 2682 */ 2683 int async_share_out_finalize( ipc_callid_t callid, void **dst)2684 { 2685 return ipc_answer_2(c allid, EOK, (sysarg_t) __entry, (sysarg_t) dst);2738 * @param chandle Handle of the IPC_M_DATA_WRITE call to answer. 2739 * @param dst Address of the storage for the destination address space area 2740 * base address. 2741 * 2742 * @return Zero on success or a value from @ref errno.h on failure. 2743 * 2744 */ 2745 int async_share_out_finalize(cap_handle_t chandle, void **dst) 2746 { 2747 return ipc_answer_2(chandle, EOK, (sysarg_t) __entry, (sysarg_t) dst); 2686 2748 } 2687 2749 … … 2709 2771 * @param size Size of the destination buffer. 2710 2772 * 2711 * @return Zero on success or a negativeerror code from errno.h.2773 * @return Zero on success or an error code from errno.h. 2712 2774 * 2713 2775 */ … … 2729 2791 * So far, this wrapper is to be used from within a connection fibril. 2730 2792 * 2731 * @param c allid Storage for the hashof the IPC_M_DATA_READ.2732 * @param size Storage for the maximum size. Can be NULL.2793 * @param chandle Storage for the handle of the IPC_M_DATA_READ. 2794 * @param size Storage for the maximum size. Can be NULL. 2733 2795 * 2734 2796 * @return True on success, false on failure. 2735 2797 * 2736 2798 */ 2737 bool async_data_read_receive( ipc_callid_t *callid, size_t *size)2799 bool async_data_read_receive(cap_handle_t *chandle, size_t *size) 2738 2800 { 2739 2801 ipc_call_t data; 2740 return async_data_read_receive_call(c allid, &data, size);2802 return async_data_read_receive_call(chandle, &data, size); 2741 2803 } 2742 2804 … … 2749 2811 * So far, this wrapper is to be used from within a connection fibril. 2750 2812 * 2751 * @param c allid Storage for the hashof the IPC_M_DATA_READ.2752 * @param size Storage for the maximum size. Can be NULL.2813 * @param chandle Storage for the handle of the IPC_M_DATA_READ. 2814 * @param size Storage for the maximum size. Can be NULL. 2753 2815 * 2754 2816 * @return True on success, false on failure. 2755 2817 * 2756 2818 */ 2757 bool async_data_read_receive_call( ipc_callid_t *callid, ipc_call_t *data,2819 bool async_data_read_receive_call(cap_handle_t *chandle, ipc_call_t *data, 2758 2820 size_t *size) 2759 2821 { 2760 assert(c allid);2822 assert(chandle); 2761 2823 assert(data); 2762 2824 2763 *c allid= async_get_call(data);2825 *chandle = async_get_call(data); 2764 2826 2765 2827 if (IPC_GET_IMETHOD(*data) != IPC_M_DATA_READ) … … 2778 2840 * argument. 2779 2841 * 2780 * @param c allid Hashof the IPC_M_DATA_READ call to answer.2781 * @param src Source address for the IPC_M_DATA_READ call.2782 * @param size Size for the IPC_M_DATA_READ call. Can be smaller than2783 * the maximum size announced by the sender.2784 * 2785 * @return Zero on success or a value from @ref errno.h on failure.2786 * 2787 */ 2788 int async_data_read_finalize( ipc_callid_t callid, const void *src, size_t size)2789 { 2790 return ipc_answer_2(c allid, EOK, (sysarg_t) src, (sysarg_t) size);2842 * @param chandle Handle of the IPC_M_DATA_READ call to answer. 2843 * @param src Source address for the IPC_M_DATA_READ call. 2844 * @param size Size for the IPC_M_DATA_READ call. Can be smaller than 2845 * the maximum size announced by the sender. 2846 * 2847 * @return Zero on success or a value from @ref errno.h on failure. 2848 * 2849 */ 2850 int async_data_read_finalize(cap_handle_t chandle, const void *src, size_t size) 2851 { 2852 return ipc_answer_2(chandle, EOK, (sysarg_t) src, (sysarg_t) size); 2791 2853 } 2792 2854 … … 2801 2863 return ENOENT; 2802 2864 2803 ipc_callid_t callid;2804 if (!async_data_read_receive(&c allid, NULL)) {2805 ipc_answer_0(c allid, EINVAL);2865 cap_handle_t chandle; 2866 if (!async_data_read_receive(&chandle, NULL)) { 2867 ipc_answer_0(chandle, EINVAL); 2806 2868 return EINVAL; 2807 2869 } … … 2810 2872 dataptr); 2811 2873 if (msg == 0) { 2812 ipc_answer_0(c allid, EINVAL);2874 ipc_answer_0(chandle, EINVAL); 2813 2875 return EINVAL; 2814 2876 } 2815 2877 2816 int retval = ipc_forward_fast(c allid, exch->phone, 0, 0, 0,2878 int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0, 2817 2879 IPC_FF_ROUTE_FROM_ME); 2818 2880 if (retval != EOK) { 2819 2881 async_forget(msg); 2820 ipc_answer_0(c allid, retval);2882 ipc_answer_0(chandle, retval); 2821 2883 return retval; 2822 2884 } 2823 2885 2824 sysarg_t rc;2886 int rc; 2825 2887 async_wait_for(msg, &rc); 2826 2888 … … 2834 2896 * @param size Size of the source buffer. 2835 2897 * 2836 * @return Zero on success or a negativeerror code from errno.h.2898 * @return Zero on success or an error code from errno.h. 2837 2899 * 2838 2900 */ … … 2854 2916 * So far, this wrapper is to be used from within a connection fibril. 2855 2917 * 2856 * @param c allid Storage for the hashof the IPC_M_DATA_WRITE.2857 * @param size Storage for the suggested size. May be NULL.2858 * 2859 * @return True on success, false on failure.2860 * 2861 */ 2862 bool async_data_write_receive( ipc_callid_t *callid, size_t *size)2918 * @param chandle Storage for the handle of the IPC_M_DATA_WRITE. 2919 * @param size Storage for the suggested size. May be NULL. 2920 * 2921 * @return True on success, false on failure. 2922 * 2923 */ 2924 bool async_data_write_receive(cap_handle_t *chandle, size_t *size) 2863 2925 { 2864 2926 ipc_call_t data; 2865 return async_data_write_receive_call(c allid, &data, size);2927 return async_data_write_receive_call(chandle, &data, size); 2866 2928 } 2867 2929 … … 2874 2936 * So far, this wrapper is to be used from within a connection fibril. 2875 2937 * 2876 * @param c allid Storage for the hashof the IPC_M_DATA_WRITE.2877 * @param data Storage for the ipc call data.2878 * @param size Storage for the suggested size. May be NULL.2938 * @param chandle Storage for the handle of the IPC_M_DATA_WRITE. 2939 * @param data Storage for the ipc call data. 2940 * @param size Storage for the suggested size. May be NULL. 2879 2941 * 2880 2942 * @return True on success, false on failure. 2881 2943 * 2882 2944 */ 2883 bool async_data_write_receive_call( ipc_callid_t *callid, ipc_call_t *data,2945 bool async_data_write_receive_call(cap_handle_t *chandle, ipc_call_t *data, 2884 2946 size_t *size) 2885 2947 { 2886 assert(c allid);2948 assert(chandle); 2887 2949 assert(data); 2888 2950 2889 *c allid= async_get_call(data);2951 *chandle = async_get_call(data); 2890 2952 2891 2953 if (IPC_GET_IMETHOD(*data) != IPC_M_DATA_WRITE) … … 2904 2966 * argument. 2905 2967 * 2906 * @param c allid Hashof the IPC_M_DATA_WRITE call to answer.2907 * @param dst Final destination address for the IPC_M_DATA_WRITE call.2908 * @param size Final size for the IPC_M_DATA_WRITE call.2909 * 2910 * @return Zero on success or a value from @ref errno.h on failure.2911 * 2912 */ 2913 int async_data_write_finalize( ipc_callid_t callid, void *dst, size_t size)2914 { 2915 return ipc_answer_2(c allid, EOK, (sysarg_t) dst, (sysarg_t) size);2968 * @param chandle Handle of the IPC_M_DATA_WRITE call to answer. 2969 * @param dst Final destination address for the IPC_M_DATA_WRITE call. 2970 * @param size Final size for the IPC_M_DATA_WRITE call. 2971 * 2972 * @return Zero on success or a value from @ref errno.h on failure. 2973 * 2974 */ 2975 int async_data_write_finalize(cap_handle_t chandle, void *dst, size_t size) 2976 { 2977 return ipc_answer_2(chandle, EOK, (sysarg_t) dst, (sysarg_t) size); 2916 2978 } 2917 2979 … … 2943 3005 assert(data); 2944 3006 2945 ipc_callid_t callid;3007 cap_handle_t chandle; 2946 3008 size_t size; 2947 if (!async_data_write_receive(&c allid, &size)) {2948 ipc_answer_0(c allid, EINVAL);3009 if (!async_data_write_receive(&chandle, &size)) { 3010 ipc_answer_0(chandle, EINVAL); 2949 3011 return EINVAL; 2950 3012 } 2951 3013 2952 3014 if (size < min_size) { 2953 ipc_answer_0(c allid, EINVAL);3015 ipc_answer_0(chandle, EINVAL); 2954 3016 return EINVAL; 2955 3017 } 2956 3018 2957 3019 if ((max_size > 0) && (size > max_size)) { 2958 ipc_answer_0(c allid, EINVAL);3020 ipc_answer_0(chandle, EINVAL); 2959 3021 return EINVAL; 2960 3022 } 2961 3023 2962 3024 if ((granularity > 0) && ((size % granularity) != 0)) { 2963 ipc_answer_0(c allid, EINVAL);3025 ipc_answer_0(chandle, EINVAL); 2964 3026 return EINVAL; 2965 3027 } … … 2973 3035 2974 3036 if (arg_data == NULL) { 2975 ipc_answer_0(c allid, ENOMEM);3037 ipc_answer_0(chandle, ENOMEM); 2976 3038 return ENOMEM; 2977 3039 } 2978 3040 2979 int rc = async_data_write_finalize(c allid, arg_data, size);3041 int rc = async_data_write_finalize(chandle, arg_data, size); 2980 3042 if (rc != EOK) { 2981 3043 free(arg_data); … … 3000 3062 * 3001 3063 */ 3002 void async_data_write_void( sysarg_t retval)3003 { 3004 ipc_callid_t callid;3005 async_data_write_receive(&c allid, NULL);3006 ipc_answer_0(c allid, retval);3064 void async_data_write_void(int retval) 3065 { 3066 cap_handle_t chandle; 3067 async_data_write_receive(&chandle, NULL); 3068 ipc_answer_0(chandle, retval); 3007 3069 } 3008 3070 … … 3017 3079 return ENOENT; 3018 3080 3019 ipc_callid_t callid;3020 if (!async_data_write_receive(&c allid, NULL)) {3021 ipc_answer_0(c allid, EINVAL);3081 cap_handle_t chandle; 3082 if (!async_data_write_receive(&chandle, NULL)) { 3083 ipc_answer_0(chandle, EINVAL); 3022 3084 return EINVAL; 3023 3085 } … … 3026 3088 dataptr); 3027 3089 if (msg == 0) { 3028 ipc_answer_0(c allid, EINVAL);3090 ipc_answer_0(chandle, EINVAL); 3029 3091 return EINVAL; 3030 3092 } 3031 3093 3032 int retval = ipc_forward_fast(c allid, exch->phone, 0, 0, 0,3094 int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0, 3033 3095 IPC_FF_ROUTE_FROM_ME); 3034 3096 if (retval != EOK) { 3035 3097 async_forget(msg); 3036 ipc_answer_0(c allid, retval);3098 ipc_answer_0(chandle, retval); 3037 3099 return retval; 3038 3100 } 3039 3101 3040 sysarg_t rc;3102 int rc; 3041 3103 async_wait_for(msg, &rc); 3042 3104 … … 3059 3121 /* Accept the phone */ 3060 3122 ipc_call_t call; 3061 ipc_callid_t callid = async_get_call(&call); 3062 int phone = (int) IPC_GET_ARG5(call); 3063 3064 if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) || 3065 (phone < 0)) { 3066 async_answer_0(callid, EINVAL); 3123 cap_handle_t chandle = async_get_call(&call); 3124 cap_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(call); 3125 3126 if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) || (phandle < 0)) { 3127 async_answer_0(chandle, EINVAL); 3067 3128 return NULL; 3068 3129 } … … 3070 3131 async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t)); 3071 3132 if (sess == NULL) { 3072 async_answer_0(c allid, ENOMEM);3133 async_answer_0(chandle, ENOMEM); 3073 3134 return NULL; 3074 3135 } … … 3076 3137 sess->iface = 0; 3077 3138 sess->mgmt = mgmt; 3078 sess->phone = ph one;3139 sess->phone = phandle; 3079 3140 sess->arg1 = 0; 3080 3141 sess->arg2 = 0; … … 3089 3150 3090 3151 /* Acknowledge the connected phone */ 3091 async_answer_0(c allid, EOK);3152 async_answer_0(chandle, EOK); 3092 3153 3093 3154 return sess; … … 3110 3171 async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call) 3111 3172 { 3112 int phone = (int) IPC_GET_ARG5(*call); 3113 3114 if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) || 3115 (phone < 0)) 3173 cap_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(*call); 3174 3175 if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) || (phandle < 0)) 3116 3176 return NULL; 3117 3177 … … 3122 3182 sess->iface = 0; 3123 3183 sess->mgmt = mgmt; 3124 sess->phone = ph one;3184 sess->phone = phandle; 3125 3185 sess->arg1 = 0; 3126 3186 sess->arg2 = 0; … … 3144 3204 } 3145 3205 3146 bool async_state_change_receive( ipc_callid_t *callid, sysarg_t *arg1,3206 bool async_state_change_receive(cap_handle_t *chandle, sysarg_t *arg1, 3147 3207 sysarg_t *arg2, sysarg_t *arg3) 3148 3208 { 3149 assert(c allid);3209 assert(chandle); 3150 3210 3151 3211 ipc_call_t call; 3152 *c allid= async_get_call(&call);3212 *chandle = async_get_call(&call); 3153 3213 3154 3214 if (IPC_GET_IMETHOD(call) != IPC_M_STATE_CHANGE_AUTHORIZE) … … 3165 3225 } 3166 3226 3167 int async_state_change_finalize( ipc_callid_t callid, async_exch_t *other_exch)3168 { 3169 return ipc_answer_1(c allid, EOK, other_exch->phone);3227 int async_state_change_finalize(cap_handle_t chandle, async_exch_t *other_exch) 3228 { 3229 return ipc_answer_1(chandle, EOK, other_exch->phone); 3170 3230 } 3171 3231
Note:
See TracChangeset
for help on using the changeset viewer.