Changeset c33f39f in mainline
- Timestamp:
- 2012-09-04T21:12:43Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 983cabe8
- Parents:
- 2541646
- Location:
- kernel/generic
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
r2541646 rc33f39f 72 72 typedef struct answerbox { 73 73 IRQ_SPINLOCK_DECLARE(lock); 74 75 /** Answerbox is active until it enters cleanup. */ 76 bool active; 74 77 75 78 struct task *task; … … 171 174 172 175 extern void ipc_phone_init(phone_t *); 173 extern voidipc_phone_connect(phone_t *, answerbox_t *);176 extern bool ipc_phone_connect(phone_t *, answerbox_t *); 174 177 extern int ipc_phone_hangup(phone_t *); 175 178 -
kernel/generic/include/ipc/ipcrsc.h
r2541646 rc33f39f 42 42 extern int phone_get(sysarg_t, phone_t **); 43 43 extern int phone_alloc(task_t *); 44 extern voidphone_connect(int, answerbox_t *);44 extern bool phone_connect(int, answerbox_t *); 45 45 extern void phone_dealloc(int); 46 46 -
kernel/generic/src/ipc/ipc.c
r2541646 rc33f39f 137 137 * @param phone Initialized phone structure. 138 138 * @param box Initialized answerbox structure. 139 * 140 */ 141 void ipc_phone_connect(phone_t *phone, answerbox_t *box) 142 { 139 * @return True if the phone was connected, false otherwise. 140 */ 141 bool ipc_phone_connect(phone_t *phone, answerbox_t *box) 142 { 143 bool active; 144 143 145 mutex_lock(&phone->lock); 144 145 phone->state = IPC_PHONE_CONNECTED;146 phone->callee = box;147 148 146 irq_spinlock_lock(&box->lock, true); 149 list_append(&phone->link, &box->connected_phones); 147 148 active = box->active; 149 if (active) { 150 phone->state = IPC_PHONE_CONNECTED; 151 phone->callee = box; 152 list_append(&phone->link, &box->connected_phones); 153 } 154 150 155 irq_spinlock_unlock(&box->lock, true); 151 152 156 mutex_unlock(&phone->lock); 157 158 return active; 153 159 } 154 160 … … 684 690 void ipc_cleanup(void) 685 691 { 692 /* 693 * Mark the answerbox as inactive. 694 * 695 * The main purpose for doing this is to prevent any pending callback 696 * connections from getting established beyond this point. 697 */ 698 irq_spinlock_lock(&TASK->answerbox.lock, true); 699 TASK->answerbox.active = false; 700 irq_spinlock_unlock(&TASK->answerbox.lock, true); 701 686 702 /* Disconnect all our phones ('ipc_phone_hangup') */ 687 703 for (size_t i = 0; i < IPC_MAX_PHONES; i++) -
kernel/generic/src/ipc/ipcrsc.c
r2541646 rc33f39f 241 241 * @param phoneid Phone handle to be connected. 242 242 * @param box Answerbox to which to connect the phone handle. 243 * @return True if the phone was connected, false otherwise. 243 244 * 244 245 * The procedure _enforces_ that the user first marks the phone … … 247 248 * 248 249 */ 249 voidphone_connect(int phoneid, answerbox_t *box)250 bool phone_connect(int phoneid, answerbox_t *box) 250 251 { 251 252 phone_t *phone = &TASK->phones[phoneid]; 252 253 253 254 ASSERT(phone->state == IPC_PHONE_CONNECTING); 254 ipc_phone_connect(phone, box);255 return ipc_phone_connect(phone, box); 255 256 } 256 257 -
kernel/generic/src/ipc/kbox.c
r2541646 rc33f39f 48 48 { 49 49 /* 50 * Not really needed, just to be consistent with the meaning of 51 * answerbox_t.active. 52 */ 53 irq_spinlock_lock(&TASK->kb.box.lock, true); 54 TASK->kb.box.active = false; 55 irq_spinlock_unlock(&TASK->kb.box.lock, true); 56 57 /* 50 58 * Only hold kb.cleanup_lock while setting kb.finished - 51 59 * this is enough. … … 234 242 235 243 /* Connect the newly allocated phone to the kbox */ 236 ipc_phone_connect(&TASK->phones[newphid], &task->kb.box);244 (void) ipc_phone_connect(&TASK->phones[newphid], &task->kb.box); 237 245 238 246 if (task->kb.thread != NULL) { -
kernel/generic/src/ipc/ops/conctmeto.c
r2541646 rc33f39f 65 65 /* If the user accepted call, connect */ 66 66 if (IPC_GET_RETVAL(answer->data) == EOK) 67 ipc_phone_connect(phone, &TASK->answerbox);67 (void) ipc_phone_connect(phone, &TASK->answerbox); 68 68 69 69 return EOK; -
kernel/generic/src/ipc/ops/concttome.c
r2541646 rc33f39f 73 73 } else if (phoneid >= 0) { 74 74 /* The connection was accepted */ 75 phone_connect(phoneid, &answer->sender->answerbox); 76 /* Set 'phone hash' as arg5 of response */ 77 IPC_SET_ARG5(answer->data, (sysarg_t) &TASK->phones[phoneid]); 75 if (phone_connect(phoneid, &answer->sender->answerbox)) { 76 /* Set 'phone hash' as arg5 of response */ 77 IPC_SET_ARG5(answer->data, 78 (sysarg_t) &TASK->phones[phoneid]); 79 } else { 80 /* The answerbox is shutting down. */ 81 IPC_SET_RETVAL(answer->data, ENOENT); 82 answer_cleanup(answer, olddata); 83 } 78 84 } else { 79 85 IPC_SET_RETVAL(answer->data, ELIMIT); -
kernel/generic/src/ipc/ops/connclone.c
r2541646 rc33f39f 87 87 } 88 88 89 ipc_phone_connect(&phone->callee->task->phones[newphid],89 (void) ipc_phone_connect(&phone->callee->task->phones[newphid], 90 90 cloned_phone->callee); 91 91 phones_unlock(cloned_phone, phone); -
kernel/generic/src/proc/task.c
r2541646 rc33f39f 206 206 event_task_init(task); 207 207 208 task->answerbox.active = true; 209 208 210 #ifdef CONFIG_UDEBUG 209 211 /* Init debugging stuff */ … … 211 213 212 214 /* Init kbox stuff */ 215 task->kb.box.active = true; 213 216 task->kb.finished = false; 214 217 #endif … … 216 219 if ((ipc_phone_0) && 217 220 (container_check(ipc_phone_0->task->container, task->container))) 218 ipc_phone_connect(&task->phones[0], ipc_phone_0);221 (void) ipc_phone_connect(&task->phones[0], ipc_phone_0); 219 222 220 223 btree_create(&task->futexes);
Note:
See TracChangeset
for help on using the changeset viewer.