Changeset b7fd2a0 in mainline for uspace/lib/c/generic/async.c
- Timestamp:
- 2018-01-13T03:10:29Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async.c
r36f0738 rb7fd2a0 205 205 ipc_call_t *dataptr; 206 206 207 int retval;207 errno_t retval; 208 208 } amsg_t; 209 209 … … 511 511 static FIBRIL_CONDVAR_INITIALIZE(avail_phone_cv); 512 512 513 int async_create_port(iface_t iface, async_port_handler_t handler,513 errno_t async_create_port(iface_t iface, async_port_handler_t handler, 514 514 void *data, port_id_t *port_id) 515 515 { … … 698 698 * 699 699 */ 700 static int connection_fibril(void *arg)700 static errno_t connection_fibril(void *arg) 701 701 { 702 702 assert(arg); … … 847 847 * 848 848 */ 849 int async_create_callback_port(async_exch_t *exch, iface_t iface, sysarg_t arg1,849 errno_t async_create_callback_port(async_exch_t *exch, iface_t iface, sysarg_t arg1, 850 850 sysarg_t arg2, async_port_handler_t handler, void *data, port_id_t *port_id) 851 851 { … … 860 860 &answer); 861 861 862 int ret;862 errno_t ret; 863 863 async_wait_for(req, &ret); 864 864 if (ret != EOK) 865 return ( int) ret;865 return (errno_t) ret; 866 866 867 867 sysarg_t phone_hash = IPC_GET_ARG5(answer); … … 1056 1056 * 1057 1057 */ 1058 int async_irq_subscribe(int inr, async_notification_handler_t handler,1058 errno_t async_irq_subscribe(int inr, async_notification_handler_t handler, 1059 1059 void *data, const irq_code_t *ucode, cap_handle_t *handle) 1060 1060 { … … 1078 1078 1079 1079 cap_handle_t cap; 1080 int rc = ipc_irq_subscribe(inr, imethod, ucode, &cap);1080 errno_t rc = ipc_irq_subscribe(inr, imethod, ucode, &cap); 1081 1081 if (rc == EOK && handle != NULL) { 1082 1082 *handle = cap; … … 1092 1092 * 1093 1093 */ 1094 int async_irq_unsubscribe(int cap)1094 errno_t async_irq_unsubscribe(int cap) 1095 1095 { 1096 1096 // TODO: Remove entry from hash table … … 1109 1109 * 1110 1110 */ 1111 int async_event_subscribe(event_type_t evno,1111 errno_t async_event_subscribe(event_type_t evno, 1112 1112 async_notification_handler_t handler, void *data) 1113 1113 { … … 1142 1142 * 1143 1143 */ 1144 int async_event_task_subscribe(event_task_type_t evno,1144 errno_t async_event_task_subscribe(event_task_type_t evno, 1145 1145 async_notification_handler_t handler, void *data) 1146 1146 { … … 1173 1173 * 1174 1174 */ 1175 int async_event_unmask(event_type_t evno)1175 errno_t async_event_unmask(event_type_t evno) 1176 1176 { 1177 1177 return ipc_event_unmask(evno); … … 1185 1185 * 1186 1186 */ 1187 int async_event_task_unmask(event_task_type_t evno)1187 errno_t async_event_task_unmask(event_task_type_t evno) 1188 1188 { 1189 1189 return ipc_event_task_unmask(evno); … … 1437 1437 * 1438 1438 */ 1439 static int async_manager_worker(void)1439 static errno_t async_manager_worker(void) 1440 1440 { 1441 1441 while (true) { … … 1489 1489 1490 1490 ipc_call_t call; 1491 int rc = ipc_wait_cycle(&call, timeout, flags);1491 errno_t rc = ipc_wait_cycle(&call, timeout, flags); 1492 1492 1493 1493 atomic_dec(&threads_in_ipc_wait); … … 1521 1521 * 1522 1522 */ 1523 static int async_manager_fibril(void *arg)1523 static errno_t async_manager_fibril(void *arg) 1524 1524 { 1525 1525 futex_up(&async_futex); … … 1597 1597 * 1598 1598 */ 1599 void reply_received(void *arg, int retval, ipc_call_t *data)1599 void reply_received(void *arg, errno_t retval, ipc_call_t *data) 1600 1600 { 1601 1601 assert(arg); … … 1709 1709 * 1710 1710 */ 1711 void async_wait_for(aid_t amsgid, int *retval)1711 void async_wait_for(aid_t amsgid, errno_t *retval) 1712 1712 { 1713 1713 assert(amsgid); … … 1755 1755 * 1756 1756 */ 1757 int async_wait_timeout(aid_t amsgid, int *retval, suseconds_t timeout)1757 errno_t async_wait_timeout(aid_t amsgid, errno_t *retval, suseconds_t timeout) 1758 1758 { 1759 1759 assert(amsgid); … … 1918 1918 * 1919 1919 */ 1920 int async_req_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,1920 errno_t async_req_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1, 1921 1921 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2, 1922 1922 sysarg_t *r3, sysarg_t *r4, sysarg_t *r5) … … 1929 1929 &result); 1930 1930 1931 int rc;1931 errno_t rc; 1932 1932 async_wait_for(aid, &rc); 1933 1933 … … 1970 1970 * 1971 1971 */ 1972 int async_req_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,1972 errno_t async_req_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1, 1973 1973 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1, 1974 1974 sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5) … … 1981 1981 &result); 1982 1982 1983 int rc;1983 errno_t rc; 1984 1984 async_wait_for(aid, &rc); 1985 1985 … … 2045 2045 } 2046 2046 2047 int async_answer_0(cap_handle_t chandle, int retval)2047 errno_t async_answer_0(cap_handle_t chandle, errno_t retval) 2048 2048 { 2049 2049 return ipc_answer_0(chandle, retval); 2050 2050 } 2051 2051 2052 int async_answer_1(cap_handle_t chandle, int retval, sysarg_t arg1)2052 errno_t async_answer_1(cap_handle_t chandle, errno_t retval, sysarg_t arg1) 2053 2053 { 2054 2054 return ipc_answer_1(chandle, retval, arg1); 2055 2055 } 2056 2056 2057 int async_answer_2(cap_handle_t chandle, int retval, sysarg_t arg1,2057 errno_t async_answer_2(cap_handle_t chandle, errno_t retval, sysarg_t arg1, 2058 2058 sysarg_t arg2) 2059 2059 { … … 2061 2061 } 2062 2062 2063 int async_answer_3(cap_handle_t chandle, int retval, sysarg_t arg1,2063 errno_t async_answer_3(cap_handle_t chandle, errno_t retval, sysarg_t arg1, 2064 2064 sysarg_t arg2, sysarg_t arg3) 2065 2065 { … … 2067 2067 } 2068 2068 2069 int async_answer_4(cap_handle_t chandle, int retval, sysarg_t arg1,2069 errno_t async_answer_4(cap_handle_t chandle, errno_t retval, sysarg_t arg1, 2070 2070 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4) 2071 2071 { … … 2073 2073 } 2074 2074 2075 int async_answer_5(cap_handle_t chandle, int retval, sysarg_t arg1,2075 errno_t async_answer_5(cap_handle_t chandle, errno_t retval, sysarg_t arg1, 2076 2076 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5) 2077 2077 { … … 2079 2079 } 2080 2080 2081 int async_forward_fast(cap_handle_t chandle, async_exch_t *exch,2081 errno_t async_forward_fast(cap_handle_t chandle, async_exch_t *exch, 2082 2082 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode) 2083 2083 { … … 2088 2088 } 2089 2089 2090 int async_forward_slow(cap_handle_t chandle, async_exch_t *exch,2090 errno_t async_forward_slow(cap_handle_t chandle, async_exch_t *exch, 2091 2091 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, 2092 2092 sysarg_t arg4, sysarg_t arg5, unsigned int mode) … … 2111 2111 * 2112 2112 */ 2113 int async_connect_to_me(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,2113 errno_t async_connect_to_me(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2, 2114 2114 sysarg_t arg3) 2115 2115 { … … 2121 2121 &answer); 2122 2122 2123 int rc;2123 errno_t rc; 2124 2124 async_wait_for(req, &rc); 2125 2125 if (rc != EOK) 2126 return ( int) rc;2126 return (errno_t) rc; 2127 2127 2128 2128 return EOK; 2129 2129 } 2130 2130 2131 static int async_connect_me_to_internal(int phone, sysarg_t arg1, sysarg_t arg2,2131 static errno_t async_connect_me_to_internal(int phone, sysarg_t arg1, sysarg_t arg2, 2132 2132 sysarg_t arg3, sysarg_t arg4, int *out_phone) 2133 2133 { … … 2148 2148 msg, reply_received); 2149 2149 2150 int rc;2150 errno_t rc; 2151 2151 async_wait_for((aid_t) msg, &rc); 2152 2152 … … 2186 2186 2187 2187 int phone; 2188 int rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,2188 errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3, 2189 2189 0, &phone); 2190 2190 if (rc != EOK) { … … 2239 2239 2240 2240 int phone; 2241 int rc = async_connect_me_to_internal(exch->phone, iface, arg2,2241 errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2, 2242 2242 arg3, 0, &phone); 2243 2243 if (rc != EOK) { … … 2310 2310 2311 2311 int phone; 2312 int rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3,2312 errno_t rc = async_connect_me_to_internal(exch->phone, arg1, arg2, arg3, 2313 2313 IPC_FLAG_BLOCKING, &phone); 2314 2314 … … 2364 2364 2365 2365 int phone; 2366 int rc = async_connect_me_to_internal(exch->phone, iface, arg2,2366 errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2, 2367 2367 arg3, IPC_FLAG_BLOCKING, &phone); 2368 2368 if (rc != EOK) { … … 2400 2400 2401 2401 cap_handle_t phone; 2402 int rc = ipc_connect_kbox(id, &phone);2402 errno_t rc = ipc_connect_kbox(id, &phone); 2403 2403 if (rc != EOK) { 2404 2404 errno = rc; … … 2424 2424 } 2425 2425 2426 static int async_hangup_internal(int phone)2426 static errno_t async_hangup_internal(int phone) 2427 2427 { 2428 2428 return ipc_hangup(phone); … … 2436 2436 * 2437 2437 */ 2438 int async_hangup(async_sess_t *sess)2438 errno_t async_hangup(async_sess_t *sess) 2439 2439 { 2440 2440 async_exch_t *exch; … … 2447 2447 fibril_mutex_lock(&async_sess_mutex); 2448 2448 2449 int rc = async_hangup_internal(sess->phone);2449 errno_t rc = async_hangup_internal(sess->phone); 2450 2450 2451 2451 while (!list_empty(&sess->exch_list)) { … … 2519 2519 } else if (mgmt == EXCHANGE_PARALLEL) { 2520 2520 int phone; 2521 int rc;2521 errno_t rc; 2522 2522 2523 2523 retry: … … 2616 2616 * 2617 2617 */ 2618 int async_share_in_start(async_exch_t *exch, size_t size, sysarg_t arg,2618 errno_t async_share_in_start(async_exch_t *exch, size_t size, sysarg_t arg, 2619 2619 unsigned int *flags, void **dst) 2620 2620 { … … 2624 2624 sysarg_t _flags = 0; 2625 2625 sysarg_t _dst = (sysarg_t) -1; 2626 int res = async_req_2_4(exch, IPC_M_SHARE_IN, (sysarg_t) size,2626 errno_t res = async_req_2_4(exch, IPC_M_SHARE_IN, (sysarg_t) size, 2627 2627 arg, NULL, &_flags, NULL, &_dst); 2628 2628 … … 2676 2676 * 2677 2677 */ 2678 int async_share_in_finalize(cap_handle_t chandle, void *src, unsigned int flags)2678 errno_t async_share_in_finalize(cap_handle_t chandle, void *src, unsigned int flags) 2679 2679 { 2680 2680 return ipc_answer_3(chandle, EOK, (sysarg_t) src, (sysarg_t) flags, … … 2691 2691 * 2692 2692 */ 2693 int async_share_out_start(async_exch_t *exch, void *src, unsigned int flags)2693 errno_t async_share_out_start(async_exch_t *exch, void *src, unsigned int flags) 2694 2694 { 2695 2695 if (exch == NULL) … … 2746 2746 * 2747 2747 */ 2748 int async_share_out_finalize(cap_handle_t chandle, void **dst)2748 errno_t async_share_out_finalize(cap_handle_t chandle, void **dst) 2749 2749 { 2750 2750 return ipc_answer_2(chandle, EOK, (sysarg_t) __entry, (sysarg_t) dst); … … 2777 2777 * 2778 2778 */ 2779 int async_data_read_start(async_exch_t *exch, void *dst, size_t size)2779 errno_t async_data_read_start(async_exch_t *exch, void *dst, size_t size) 2780 2780 { 2781 2781 if (exch == NULL) … … 2851 2851 * 2852 2852 */ 2853 int async_data_read_finalize(cap_handle_t chandle, const void *src, size_t size)2853 errno_t async_data_read_finalize(cap_handle_t chandle, const void *src, size_t size) 2854 2854 { 2855 2855 return ipc_answer_2(chandle, EOK, (sysarg_t) src, (sysarg_t) size); … … 2859 2859 * 2860 2860 */ 2861 int async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod,2861 errno_t async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod, 2862 2862 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, 2863 2863 ipc_call_t *dataptr) … … 2879 2879 } 2880 2880 2881 int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,2881 errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0, 2882 2882 IPC_FF_ROUTE_FROM_ME); 2883 2883 if (retval != EOK) { … … 2887 2887 } 2888 2888 2889 int rc;2889 errno_t rc; 2890 2890 async_wait_for(msg, &rc); 2891 2891 2892 return ( int) rc;2892 return (errno_t) rc; 2893 2893 } 2894 2894 … … 2902 2902 * 2903 2903 */ 2904 int async_data_write_start(async_exch_t *exch, const void *src, size_t size)2904 errno_t async_data_write_start(async_exch_t *exch, const void *src, size_t size) 2905 2905 { 2906 2906 if (exch == NULL) … … 2976 2976 * 2977 2977 */ 2978 int async_data_write_finalize(cap_handle_t chandle, void *dst, size_t size)2978 errno_t async_data_write_finalize(cap_handle_t chandle, void *dst, size_t size) 2979 2979 { 2980 2980 return ipc_answer_2(chandle, EOK, (sysarg_t) dst, (sysarg_t) size); … … 3002 3002 * 3003 3003 */ 3004 int async_data_write_accept(void **data, const bool nullterm,3004 errno_t async_data_write_accept(void **data, const bool nullterm, 3005 3005 const size_t min_size, const size_t max_size, const size_t granularity, 3006 3006 size_t *received) … … 3042 3042 } 3043 3043 3044 int rc = async_data_write_finalize(chandle, arg_data, size);3044 errno_t rc = async_data_write_finalize(chandle, arg_data, size); 3045 3045 if (rc != EOK) { 3046 3046 free(arg_data); … … 3065 3065 * 3066 3066 */ 3067 void async_data_write_void( int retval)3067 void async_data_write_void(errno_t retval) 3068 3068 { 3069 3069 cap_handle_t chandle; … … 3075 3075 * 3076 3076 */ 3077 int async_data_write_forward_fast(async_exch_t *exch, sysarg_t imethod,3077 errno_t async_data_write_forward_fast(async_exch_t *exch, sysarg_t imethod, 3078 3078 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, 3079 3079 ipc_call_t *dataptr) … … 3095 3095 } 3096 3096 3097 int retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,3097 errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0, 3098 3098 IPC_FF_ROUTE_FROM_ME); 3099 3099 if (retval != EOK) { … … 3103 3103 } 3104 3104 3105 int rc;3105 errno_t rc; 3106 3106 async_wait_for(msg, &rc); 3107 3107 3108 return ( int) rc;3108 return (errno_t) rc; 3109 3109 } 3110 3110 … … 3200 3200 } 3201 3201 3202 int async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,3202 errno_t async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2, 3203 3203 sysarg_t arg3, async_exch_t *other_exch) 3204 3204 { … … 3228 3228 } 3229 3229 3230 int async_state_change_finalize(cap_handle_t chandle, async_exch_t *other_exch)3230 errno_t async_state_change_finalize(cap_handle_t chandle, async_exch_t *other_exch) 3231 3231 { 3232 3232 return ipc_answer_1(chandle, EOK, other_exch->phone);
Note:
See TracChangeset
for help on using the changeset viewer.