Changes in kernel/generic/src/ipc/sysipc.c [36b16bc:cc574511] in mainline
- File:
-
- 1 edited
-
kernel/generic/src/ipc/sysipc.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
r36b16bc rcc574511 40 40 #include <debug.h> 41 41 #include <ipc/ipc.h> 42 #include < abi/ipc/methods.h>42 #include <ipc/ipc_methods.h> 43 43 #include <ipc/sysipc.h> 44 44 #include <ipc/irq.h> 45 45 #include <ipc/ipcrsc.h> 46 #include <ipc/event.h>47 46 #include <ipc/kbox.h> 48 47 #include <synch/waitq.h> … … 54 53 #include <mm/as.h> 55 54 #include <print.h> 56 #include <macros.h>57 55 58 56 /** … … 136 134 case IPC_M_DATA_WRITE: 137 135 case IPC_M_DATA_READ: 138 case IPC_M_STATE_CHANGE_AUTHORIZE:139 136 return true; 140 137 default: … … 167 164 case IPC_M_DATA_WRITE: 168 165 case IPC_M_DATA_READ: 169 case IPC_M_STATE_CHANGE_AUTHORIZE:170 166 return true; 171 167 default: … … 253 249 /* The connection was accepted */ 254 250 phone_connect(phoneid, &answer->sender->answerbox); 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)); 251 /* Set 'task hash' as arg4 of response */ 252 IPC_SET_ARG4(answer->data, (sysarg_t) TASK); 258 253 /* Set 'phone hash' as arg5 of response */ 259 254 IPC_SET_ARG5(answer->data, … … 339 334 free(answer->buffer); 340 335 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 the368 * 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 }387 336 } 388 337 … … 507 456 } 508 457 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);530 458 break; 531 459 }
Note:
See TracChangeset
for help on using the changeset viewer.
