Changes in kernel/generic/src/ipc/sysipc.c [ab34cc9:79ae36dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
rab34cc9 r79ae36dd 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); 251 /* Set 'task hash' as arg4 of response */ 252 IPC_SET_ARG4(answer->data, (sysarg_t) TASK); 255 253 /* Set 'phone hash' as arg5 of response */ 256 254 IPC_SET_ARG5(answer->data, … … 336 334 free(answer->buffer); 337 335 answer->buffer = NULL; 338 } else if (IPC_GET_IMETHOD(*olddata) == IPC_M_STATE_CHANGE_AUTHORIZE) {339 if (!IPC_GET_RETVAL(answer->data)) {340 /* The recipient authorized the change of state. */341 phone_t *recipient_phone;342 task_t *other_task_s;343 task_t *other_task_r;344 int rc;345 346 rc = phone_get(IPC_GET_ARG1(answer->data),347 &recipient_phone);348 if (rc != EOK) {349 IPC_SET_RETVAL(answer->data, ENOENT);350 return ENOENT;351 }352 353 mutex_lock(&recipient_phone->lock);354 if (recipient_phone->state != IPC_PHONE_CONNECTED) {355 mutex_unlock(&recipient_phone->lock);356 IPC_SET_RETVAL(answer->data, EINVAL);357 return EINVAL;358 }359 360 other_task_r = recipient_phone->callee->task;361 other_task_s = (task_t *) IPC_GET_ARG5(*olddata);362 363 /*364 * See if both the sender and the recipient meant the365 * same third party task.366 */367 if (other_task_r != other_task_s) {368 IPC_SET_RETVAL(answer->data, EINVAL);369 rc = EINVAL;370 } else {371 rc = event_task_notify_5(other_task_r,372 EVENT_TASK_STATE_CHANGE, false,373 IPC_GET_ARG1(*olddata),374 IPC_GET_ARG2(*olddata),375 IPC_GET_ARG3(*olddata),376 LOWER32(olddata->task_id),377 UPPER32(olddata->task_id));378 IPC_SET_RETVAL(answer->data, rc);379 }380 381 mutex_unlock(&recipient_phone->lock);382 return rc;383 }384 336 } 385 337 … … 475 427 case IPC_M_DATA_READ: { 476 428 size_t size = IPC_GET_ARG2(call->data); 429 if (size <= 0) 430 return ELIMIT; 477 431 if (size > DATA_XFER_LIMIT) { 478 432 int flags = IPC_GET_ARG3(call->data); … … 504 458 } 505 459 506 break;507 }508 case IPC_M_STATE_CHANGE_AUTHORIZE: {509 phone_t *sender_phone;510 task_t *other_task_s;511 512 if (phone_get(IPC_GET_ARG5(call->data), &sender_phone) != EOK)513 return ENOENT;514 515 mutex_lock(&sender_phone->lock);516 if (sender_phone->state != IPC_PHONE_CONNECTED) {517 mutex_unlock(&sender_phone->lock);518 return EINVAL;519 }520 521 other_task_s = sender_phone->callee->task;522 523 mutex_unlock(&sender_phone->lock);524 525 /* Remember the third party task hash. */526 IPC_SET_ARG5(call->data, (sysarg_t) other_task_s);527 460 break; 528 461 }
Note:
See TracChangeset
for help on using the changeset viewer.