Changeset 07b39338 in mainline for kernel/generic/src/ipc/sysipc.c
- Timestamp:
- 2011-08-20T18:21:49Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ab014d
- Parents:
- 0cf27ee (diff), f00af83 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
r0cf27ee r07b39338 44 44 #include <ipc/irq.h> 45 45 #include <ipc/ipcrsc.h> 46 #include <ipc/event.h> 46 47 #include <ipc/kbox.h> 47 48 #include <synch/waitq.h> … … 53 54 #include <mm/as.h> 54 55 #include <print.h> 56 #include <macros.h> 55 57 56 58 /** … … 134 136 case IPC_M_DATA_WRITE: 135 137 case IPC_M_DATA_READ: 138 case IPC_M_STATE_CHANGE_AUTHORIZE: 136 139 return true; 137 140 default: … … 164 167 case IPC_M_DATA_WRITE: 165 168 case IPC_M_DATA_READ: 169 case IPC_M_STATE_CHANGE_AUTHORIZE: 166 170 return true; 167 171 default: … … 249 253 /* The connection was accepted */ 250 254 phone_connect(phoneid, &answer->sender->answerbox); 251 /* Set 'task hash' as arg4 of response */ 252 IPC_SET_ARG4(answer->data, (sysarg_t) TASK); 255 /* Set 'task ID' as arg3 and arg4 of response */ 256 IPC_SET_ARG3(answer->data, LOWER32(TASK->taskid)); 257 IPC_SET_ARG4(answer->data, UPPER32(TASK->taskid)); 253 258 /* Set 'phone hash' as arg5 of response */ 254 259 IPC_SET_ARG5(answer->data, … … 334 339 free(answer->buffer); 335 340 answer->buffer = NULL; 341 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_STATE_CHANGE_AUTHORIZE) { 342 if (!IPC_GET_RETVAL(answer->data)) { 343 /* The recipient authorized the change of state. */ 344 phone_t *recipient_phone; 345 task_t *other_task_s; 346 task_t *other_task_r; 347 int rc; 348 349 rc = phone_get(IPC_GET_ARG1(answer->data), 350 &recipient_phone); 351 if (rc != EOK) { 352 IPC_SET_RETVAL(answer->data, ENOENT); 353 return ENOENT; 354 } 355 356 mutex_lock(&recipient_phone->lock); 357 if (recipient_phone->state != IPC_PHONE_CONNECTED) { 358 mutex_unlock(&recipient_phone->lock); 359 IPC_SET_RETVAL(answer->data, EINVAL); 360 return EINVAL; 361 } 362 363 other_task_r = recipient_phone->callee->task; 364 other_task_s = (task_t *) IPC_GET_ARG5(*olddata); 365 366 /* 367 * See if both the sender and the recipient meant the 368 * same third party task. 369 */ 370 if (other_task_r != other_task_s) { 371 IPC_SET_RETVAL(answer->data, EINVAL); 372 rc = EINVAL; 373 } else { 374 rc = event_task_notify_5(other_task_r, 375 EVENT_TASK_STATE_CHANGE, false, 376 IPC_GET_ARG1(*olddata), 377 IPC_GET_ARG2(*olddata), 378 IPC_GET_ARG3(*olddata), 379 LOWER32(olddata->task_id), 380 UPPER32(olddata->task_id)); 381 IPC_SET_RETVAL(answer->data, rc); 382 } 383 384 mutex_unlock(&recipient_phone->lock); 385 return rc; 386 } 336 387 } 337 388 … … 456 507 } 457 508 509 break; 510 } 511 case IPC_M_STATE_CHANGE_AUTHORIZE: { 512 phone_t *sender_phone; 513 task_t *other_task_s; 514 515 if (phone_get(IPC_GET_ARG5(call->data), &sender_phone) != EOK) 516 return ENOENT; 517 518 mutex_lock(&sender_phone->lock); 519 if (sender_phone->state != IPC_PHONE_CONNECTED) { 520 mutex_unlock(&sender_phone->lock); 521 return EINVAL; 522 } 523 524 other_task_s = sender_phone->callee->task; 525 526 mutex_unlock(&sender_phone->lock); 527 528 /* Remember the third party task hash. */ 529 IPC_SET_ARG5(call->data, (sysarg_t) other_task_s); 458 530 break; 459 531 }
Note:
See TracChangeset
for help on using the changeset viewer.