Changeset 78bb04b in mainline
- Timestamp:
- 2015-08-22T14:11:58Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0dd16778
- Parents:
- fc22069
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
abi/include/abi/ipc/interfaces.h
rfc22069 r78bb04b 80 80 typedef enum { 81 81 INTERFACE_LOADER = 82 FOURCC_COMPACT('l', 'o', 'a', 'd') | IFACE_EXCHANGE_PARALLEL 82 FOURCC_COMPACT('l', 'o', 'a', 'd') | IFACE_EXCHANGE_PARALLEL, 83 INTERFACE_TCP_CB = 84 FOURCC_COMPACT('t', 'c', 'p', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK, 85 INTERFACE_UDP_CB = 86 FOURCC_COMPACT('u', 'd', 'p', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK 83 87 } iface_t; 84 88 -
uspace/lib/c/generic/async.c
rfc22069 r78bb04b 630 630 .remove_callback = NULL 631 631 }; 632 633 /** Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework. 634 * 635 * Ask through phone for a new connection to some service. 636 * 637 * @param exch Exchange for sending the message. 638 * @param iface Callback interface. 639 * @param arg1 User defined argument. 640 * @param arg2 User defined argument. 641 * @param handler Callback handler. 642 * @param data Handler data. 643 * @param port_id ID of the newly created port. 644 * 645 * @return Zero on success or a negative error code. 646 * 647 */ 648 int async_create_callback_port(async_exch_t *exch, iface_t iface, sysarg_t arg1, 649 sysarg_t arg2, async_port_handler_t handler, void *data, port_id_t *port_id) 650 { 651 if ((iface & IFACE_MOD_CALLBACK) != IFACE_MOD_CALLBACK) 652 return EINVAL; 653 654 if (exch == NULL) 655 return ENOENT; 656 657 ipc_call_t answer; 658 aid_t req = async_send_3(exch, IPC_M_CONNECT_TO_ME, iface, arg1, arg2, 659 &answer); 660 661 sysarg_t ret; 662 async_wait_for(req, &ret); 663 if (ret != EOK) 664 return (int) ret; 665 666 sysarg_t phone_hash = IPC_GET_ARG5(answer); 667 interface_t *interface; 668 669 futex_down(&async_futex); 670 671 ht_link_t *link = hash_table_find(&interface_hash_table, &iface); 672 if (link) 673 interface = hash_table_get_inst(link, interface_t, link); 674 else 675 interface = async_new_interface(iface); 676 677 if (!interface) { 678 futex_up(&async_futex); 679 return ENOMEM; 680 } 681 682 port_t *port = async_new_port(interface, handler, data); 683 if (!port) { 684 futex_up(&async_futex); 685 return ENOMEM; 686 } 687 688 *port_id = port->id; 689 690 futex_up(&async_futex); 691 692 fid_t fid = async_new_connection(answer.in_task_id, phone_hash, 693 0, NULL, handler, data); 694 if (fid == (uintptr_t) NULL) 695 return ENOMEM; 696 697 return EOK; 698 } 632 699 633 700 static size_t notification_key_hash(void *key) -
uspace/lib/c/generic/inet/tcp.c
rfc22069 r78bb04b 66 66 67 67 aid_t req = async_send_0(exch, TCP_CALLBACK_CREATE, NULL); 68 int rc = async_connect_to_me(exch, 0, 0, 0, tcp_cb_conn, tcp); 68 69 port_id_t port; 70 int rc = async_create_callback_port(exch, INTERFACE_TCP_CB, 0, 0, 71 tcp_cb_conn, tcp, &port); 72 69 73 async_exchange_end(exch); 70 74 -
uspace/lib/c/generic/inet/udp.c
rfc22069 r78bb04b 53 53 54 54 aid_t req = async_send_0(exch, UDP_CALLBACK_CREATE, NULL); 55 int rc = async_connect_to_me(exch, 0, 0, 0, udp_cb_conn, udp); 55 56 port_id_t port; 57 int rc = async_create_callback_port(exch, INTERFACE_UDP_CB, 0, 0, 58 udp_cb_conn, udp, &port); 59 56 60 async_exchange_end(exch); 57 61 -
uspace/lib/c/include/async.h
rfc22069 r78bb04b 165 165 port_id_t *); 166 166 extern void async_set_fallback_port_handler(async_port_handler_t, void *); 167 extern int async_create_callback_port(async_exch_t *, iface_t, sysarg_t, 168 sysarg_t, async_port_handler_t, void *, port_id_t *); 169 167 170 extern void async_set_notification_handler_stack_size(size_t); 168 171
Note:
See TracChangeset
for help on using the changeset viewer.