Changeset 05ffb41 in mainline for kernel/generic/src/ipc/ops
- Timestamp:
- 2017-08-17T19:11:14Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1c85bae
- Parents:
- 7e3826d9
- Location:
- kernel/generic/src/ipc/ops
- Files:
-
- 4 edited
-
conctmeto.c (modified) (2 diffs)
-
concttome.c (modified) (3 diffs)
-
connclone.c (modified) (4 diffs)
-
stchngath.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ops/conctmeto.c
r7e3826d9 r05ffb41 42 42 static int request_preprocess(call_t *call, phone_t *phone) 43 43 { 44 int newphid= phone_alloc(TASK);44 int cap = phone_alloc(TASK); 45 45 46 /* Remember the phone idor the error. */47 call->priv = newphid;48 if ( newphid< 0)46 /* Remember the phone capability or the error. */ 47 call->priv = cap; 48 if (cap < 0) 49 49 return ELIMIT; 50 50 51 51 /* Set arg5 for server */ 52 IPC_SET_ARG5(call->data, (sysarg_t) &TASK->phones[newphid]);52 IPC_SET_ARG5(call->data, (sysarg_t) phone_get_current(cap)); 53 53 54 54 return EOK; … … 74 74 static int answer_process(call_t *answer) 75 75 { 76 int newphid= (int) answer->priv;76 int cap = (int) answer->priv; 77 77 78 78 if (IPC_GET_RETVAL(answer->data)) { 79 if ( newphid>= 0) {79 if (cap >= 0) { 80 80 /* 81 81 * The phone was indeed allocated and now needs 82 82 * to be deallocated. 83 83 */ 84 phone_dealloc( newphid);84 phone_dealloc(cap); 85 85 } 86 86 } else { 87 IPC_SET_ARG5(answer->data, newphid);87 IPC_SET_ARG5(answer->data, cap); 88 88 } 89 89 -
kernel/generic/src/ipc/ops/concttome.c
r7e3826d9 r05ffb41 42 42 static int request_process(call_t *call, answerbox_t *box) 43 43 { 44 int phoneid= phone_alloc(TASK);44 int cap = phone_alloc(TASK); 45 45 46 IPC_SET_ARG5(call->data, phoneid);46 IPC_SET_ARG5(call->data, cap); 47 47 48 48 return EOK; … … 51 51 static int answer_cleanup(call_t *answer, ipc_data_t *olddata) 52 52 { 53 int phoneid= (int) IPC_GET_ARG5(*olddata);53 int cap = (int) IPC_GET_ARG5(*olddata); 54 54 55 if ( phoneid>= 0)56 phone_dealloc( phoneid);55 if (cap >= 0) 56 phone_dealloc(cap); 57 57 58 58 return EOK; … … 61 61 static int answer_preprocess(call_t *answer, ipc_data_t *olddata) 62 62 { 63 int phoneid= (int) IPC_GET_ARG5(*olddata);63 int cap = (int) IPC_GET_ARG5(*olddata); 64 64 65 65 if (IPC_GET_RETVAL(answer->data) != EOK) { 66 66 /* The connection was not accepted */ 67 67 answer_cleanup(answer, olddata); 68 } else if ( phoneid>= 0) {68 } else if (cap >= 0) { 69 69 /* The connection was accepted */ 70 if (phone_connect( phoneid, &answer->sender->answerbox)) {70 if (phone_connect(cap, &answer->sender->answerbox)) { 71 71 /* Set 'phone hash' as arg5 of response */ 72 72 IPC_SET_ARG5(answer->data, 73 (sysarg_t) &TASK->phones[phoneid]);73 (sysarg_t) phone_get_current(cap)); 74 74 } else { 75 75 /* The answerbox is shutting down. */ -
kernel/generic/src/ipc/ops/connclone.c
r7e3826d9 r05ffb41 61 61 static int request_preprocess(call_t *call, phone_t *phone) 62 62 { 63 phone_t *cloned_phone; 64 65 if (phone_get(IPC_GET_ARG1(call->data), &cloned_phone) != EOK) 63 phone_t *cloned_phone = phone_get_current(IPC_GET_ARG1(call->data)); 64 if (!cloned_phone) 66 65 return ENOENT; 67 66 68 67 phones_lock(cloned_phone, phone); 69 68 70 69 if ((cloned_phone->state != IPC_PHONE_CONNECTED) || 71 70 phone->state != IPC_PHONE_CONNECTED) { … … 73 72 return EINVAL; 74 73 } 75 74 76 75 /* 77 76 * We can be pretty sure now that both tasks exist and we are … … 81 80 * 82 81 */ 83 int newphid= phone_alloc(phone->callee->task);84 if ( newphid< 0) {82 int cap = phone_alloc(phone->callee->task); 83 if (cap < 0) { 85 84 phones_unlock(cloned_phone, phone); 86 85 return ELIMIT; 87 86 } 88 89 (void) ipc_phone_connect( &phone->callee->task->phones[newphid],87 88 (void) ipc_phone_connect(phone_get(phone->callee->task, cap), 90 89 cloned_phone->callee); 91 90 phones_unlock(cloned_phone, phone); 92 91 93 92 /* Set the new phone for the callee. */ 94 IPC_SET_ARG1(call->data, newphid);93 IPC_SET_ARG1(call->data, cap); 95 94 96 95 return EOK; … … 99 98 static int answer_cleanup(call_t *answer, ipc_data_t *olddata) 100 99 { 101 int phoneid= (int) IPC_GET_ARG1(*olddata);102 phone_t *phone = &TASK->phones[phoneid];100 int cap = (int) IPC_GET_ARG1(*olddata); 101 phone_t *phone = phone_get_current(cap); 103 102 104 103 /* -
kernel/generic/src/ipc/ops/stchngath.c
r7e3826d9 r05ffb41 43 43 static int request_preprocess(call_t *call, phone_t *phone) 44 44 { 45 phone_t *sender_phone;46 45 task_t *other_task_s; 47 46 48 if (phone_get(IPC_GET_ARG5(call->data), &sender_phone) != EOK) 47 phone_t *sender_phone = phone_get_current(IPC_GET_ARG5(call->data)); 48 if (!sender_phone) 49 49 return ENOENT; 50 50 … … 75 75 task_t *other_task_r; 76 76 77 rc = phone_get(IPC_GET_ARG1(answer->data), 78 &recipient_phone); 79 if (rc != EOK) { 77 recipient_phone = phone_get_current(IPC_GET_ARG1(answer->data)); 78 if (!recipient_phone) { 80 79 IPC_SET_RETVAL(answer->data, ENOENT); 81 80 return ENOENT;
Note:
See TracChangeset
for help on using the changeset viewer.
