Changeset 241f1985 in mainline for uspace/lib/c/generic/async
- Timestamp:
- 2019-08-31T10:45:17Z (6 years ago)
- Children:
- 102f641
- Parents:
- f92b315
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-23 22:04:34)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-31 10:45:17)
- Location:
- uspace/lib/c/generic/async
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async/client.c
rf92b315 r241f1985 99 99 #include <async.h> 100 100 #include "../private/async.h" 101 #include "../private/ns.h"102 101 #undef _LIBC_ASYNC_C_ 103 102 … … 114 113 #include <stdbool.h> 115 114 #include <stdlib.h> 115 #include <stdatomic.h> 116 116 #include <mem.h> 117 #include <stdlib.h>118 117 #include <macros.h> 119 118 #include <as.h> … … 174 173 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3) 175 174 { 176 async_sess_t *session = (async_sess_t *) malloc(sizeof(async_sess_t));175 async_sess_t *session = (async_sess_t *) calloc(1, sizeof(async_sess_t)); 177 176 178 177 if (session != NULL) { 179 session->iface = 0;180 178 session->mgmt = mgmt; 181 179 session->phone = phone; … … 189 187 list_initialize(&session->exch_list); 190 188 fibril_mutex_initialize(&session->mutex); 191 atomic_set(&session->refcnt, 0);192 &session.exchanges = 0;193 189 } else { 194 190 errno = ENOMEM; … … 198 194 } 199 195 200 int async_session_phone(async_sess_t *sess)196 cap_phone_handle_t async_session_phone(async_sess_t *sess) 201 197 { 202 198 return sess->phone; … … 859 855 } 860 856 861 async_sess_t *sess = create_session(phone, mgmt, iface, arg2, arg3);857 async_sess_t *sess = create_session(phone, iface & IFACE_EXCHANGE_MASK, iface, arg2, arg3); 862 858 if (sess == NULL) { 863 859 ipc_hangup(phone); 864 860 } 861 sess->iface = iface; 865 862 866 863 return sess; … … 912 909 if (rc != EOK) { 913 910 errno = rc; 914 free(sess);915 911 return NULL; 916 912 } 917 913 918 async_sess_t *sess = create_session(phone, mgmt, iface, arg2, arg3);914 async_sess_t *sess = create_session(phone, iface & IFACE_EXCHANGE_MASK, iface, arg2, arg3); 919 915 if (sess == NULL) { 920 916 ipc_hangup(phone); 921 917 } 918 sess->iface = iface; 922 919 923 920 return sess; -
uspace/lib/c/generic/async/server.c
rf92b315 r241f1985 216 216 } 217 217 218 static async_client_conn_t implicit_connection = NULL; 218 static async_port_handler_t implicit_connection = NULL; 219 220 /** Setter for implicit_connection function pointer. 221 * 222 * @param conn Function that will implement a new connection fibril for 223 * unrouted calls. 224 * 225 */ 226 void async_set_implicit_connection(async_port_handler_t conn) 227 { 228 assert(implicit_connection == NULL); 229 implicit_connection = conn; 230 } 231 232 219 233 static fibril_rmutex_t client_mutex; 220 234 static hash_table_t client_hash_table; … … 969 983 return; 970 984 } else if (implicit_connection != NULL) { 971 async_new_connection(call->in_task_id, call->in_phone_hash, 972 callid, call, implicit_connection, NULL); 985 connection_t *conn = calloc(1, sizeof(connection_t)); 986 if (!conn) { 987 ipc_answer_0(call->cap_handle, ENOMEM); 988 return; 989 } 990 991 async_new_connection(conn, call->task_id, call, implicit_connection, NULL); 973 992 return; 974 993 } … … 1749 1768 async_sess_t *sess = create_session(phandle, mgmt, 0, 0, 0); 1750 1769 if (sess == NULL) { 1751 ipc_hangup(ph one);1770 ipc_hangup(phandle); 1752 1771 async_answer_0(&call, errno); 1753 1772 } else {
Note:
See TracChangeset
for help on using the changeset viewer.