Changeset bbf38ad in mainline
- Timestamp:
- 2018-03-11T07:35:05Z (7 years ago)
- Children:
- af6bd113
- Parents:
- 26a6ed4
- git-author:
- Jakub Jermar <jakub@…> (2018-03-10 19:59:41)
- git-committer:
- Jakub Jermar <jakub@…> (2018-03-11 07:35:05)
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipcrsc.h
r26a6ed4 rbbf38ad 41 41 42 42 extern errno_t phone_alloc(task_t *, bool, cap_handle_t *, kobject_t **); 43 extern bool phone_connect(cap_handle_t, answerbox_t *);44 43 extern void phone_dealloc(cap_handle_t); 45 44 -
kernel/generic/src/ipc/ipcrsc.c
r26a6ed4 rbbf38ad 209 209 } 210 210 211 /** Connect phone to a given answerbox.212 *213 * @param handle Capability handle of the phone to be connected.214 * @param box Answerbox to which to connect the phone.215 * @return True if the phone was connected, false otherwise.216 */217 bool phone_connect(cap_handle_t handle, answerbox_t *box)218 {219 kobject_t *phone_obj = kobject_get(TASK, handle, KOBJECT_TYPE_PHONE);220 if (!phone_obj)221 return false;222 223 /* Hand over phone_obj reference to the answerbox */224 return ipc_phone_connect(phone_obj->phone, box);225 }226 227 211 /** @} 228 212 */ -
kernel/generic/src/ipc/ops/concttome.c
r26a6ed4 rbbf38ad 43 43 { 44 44 cap_handle_t phone_handle; 45 errno_t rc = phone_alloc(TASK, true, &phone_handle, NULL); 45 kobject_t *phone_obj; 46 errno_t rc = phone_alloc(TASK, false, &phone_handle, &phone_obj); 47 call->priv = (sysarg_t) phone_obj; 46 48 IPC_SET_ARG5(call->data, (rc == EOK) ? phone_handle : -1); 47 49 return 0; … … 51 53 { 52 54 cap_handle_t phone_handle = (cap_handle_t) IPC_GET_ARG5(*olddata); 55 kobject_t *phone_obj = (kobject_t *) answer->priv; 53 56 54 if (phone_handle >= 0) 55 phone_dealloc(phone_handle); 57 if (phone_handle >= 0) { 58 kobject_put(phone_obj); 59 cap_free(TASK, phone_handle); 60 } 56 61 57 62 return EOK; … … 61 66 { 62 67 cap_handle_t phone_handle = (cap_handle_t) IPC_GET_ARG5(*olddata); 68 kobject_t *phone_obj = (kobject_t *) answer->priv; 63 69 64 70 if (IPC_GET_RETVAL(answer->data) != EOK) { … … 66 72 answer_cleanup(answer, olddata); 67 73 } else if (phone_handle >= 0) { 68 /* The connection was accepted */ 69 if (phone_connect(phone_handle, &answer->sender->answerbox)) { 74 /* 75 * The connection was accepted 76 * */ 77 78 /* 79 * We need to create another reference as the one we have now 80 * will be consumed by ipc_phone_connect(). 81 */ 82 kobject_add_ref(phone_obj); 83 84 if (ipc_phone_connect(phone_obj->phone, 85 &answer->sender->answerbox)) { 86 /* Pass the reference to the capability */ 87 cap_publish(TASK, phone_handle, phone_obj); 70 88 /* Set 'phone hash' as ARG5 of response */ 71 kobject_t *phone_obj = kobject_get(TASK, phone_handle,72 KOBJECT_TYPE_PHONE);73 89 IPC_SET_ARG5(answer->data, 74 90 (sysarg_t) phone_obj->phone); 75 kobject_put(phone_obj);76 91 } else { 77 92 /* The answerbox is shutting down. */
Note:
See TracChangeset
for help on using the changeset viewer.