71,8 → 71,8 |
*/ |
static inline int is_forwardable(unative_t method) |
{ |
if (method == IPC_M_PHONE_HUNGUP || method == IPC_M_AS_AREA_SEND \ |
|| method == IPC_M_AS_AREA_RECV) |
if (method == IPC_M_PHONE_HUNGUP || method == IPC_M_AS_AREA_SEND || |
method == IPC_M_AS_AREA_RECV) |
return 0; /* This message is meant only for the receiver */ |
return 1; |
} |
132,7 → 132,8 |
/* The connection was accepted */ |
phone_connect(phoneid,&answer->sender->answerbox); |
/* Set 'phone identification' as arg3 of response */ |
IPC_SET_ARG3(answer->data, (unative_t)&TASK->phones[phoneid]); |
IPC_SET_ARG3(answer->data, |
(unative_t) &TASK->phones[phoneid]); |
} |
} else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME_TO) { |
/* If the users accepted call, connect */ |
141,7 → 142,8 |
&TASK->answerbox); |
} |
} else if (IPC_GET_METHOD(*olddata) == IPC_M_AS_AREA_SEND) { |
if (!IPC_GET_RETVAL(answer->data)) { /* Accepted, handle as_area receipt */ |
if (!IPC_GET_RETVAL(answer->data)) { |
/* Accepted, handle as_area receipt */ |
ipl_t ipl; |
int rc; |
as_t *as; |
152,8 → 154,9 |
spinlock_unlock(&answer->sender->lock); |
interrupts_restore(ipl); |
|
rc = as_area_share(as, IPC_GET_ARG1(*olddata), IPC_GET_ARG2(*olddata), |
AS, IPC_GET_ARG1(answer->data), IPC_GET_ARG3(*olddata)); |
rc = as_area_share(as, IPC_GET_ARG1(*olddata), |
IPC_GET_ARG2(*olddata), AS, |
IPC_GET_ARG1(answer->data), IPC_GET_ARG3(*olddata)); |
IPC_SET_RETVAL(answer->data, rc); |
return rc; |
} |
169,8 → 172,9 |
spinlock_unlock(&answer->sender->lock); |
interrupts_restore(ipl); |
|
rc = as_area_share(AS, IPC_GET_ARG1(answer->data), IPC_GET_ARG2(*olddata), |
as, IPC_GET_ARG1(*olddata), IPC_GET_ARG2(answer->data)); |
rc = as_area_share(AS, IPC_GET_ARG1(answer->data), |
IPC_GET_ARG2(*olddata), as, IPC_GET_ARG1(*olddata), |
IPC_GET_ARG2(answer->data)); |
IPC_SET_RETVAL(answer->data, rc); |
} |
} |
217,8 → 221,8 |
/** Do basic kernel processing of received call answer */ |
static void process_answer(call_t *call) |
{ |
if (IPC_GET_RETVAL(call->data) == EHANGUP && \ |
call->flags & IPC_CALL_FORWARDED) |
if (IPC_GET_RETVAL(call->data) == EHANGUP && |
(call->flags & IPC_CALL_FORWARDED)) |
IPC_SET_RETVAL(call->data, EFORWARD); |
|
if (call->flags & IPC_CALL_CONN_ME_TO) { |
287,7 → 291,8 |
int rc; |
|
ipc_call_static_init(&call); |
rc = copy_from_uspace(&call.data.args, &question->args, sizeof(call.data.args)); |
rc = copy_from_uspace(&call.data.args, &question->args, |
sizeof(call.data.args)); |
if (rc != 0) |
return (unative_t) rc; |
|
367,7 → 372,8 |
GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL); |
|
call = ipc_call_alloc(0); |
rc = copy_from_uspace(&call->data.args, &data->args, sizeof(call->data.args)); |
rc = copy_from_uspace(&call->data.args, &data->args, |
sizeof(call->data.args)); |
if (rc != 0) { |
ipc_call_free(call); |
return (unative_t) rc; |
508,9 → 514,10 |
|
/** Wait for incoming ipc call or answer |
* |
* @param calldata Pointer to buffer where the call/answer data is stored |
* @param calldata Pointer to buffer where the call/answer data is stored. |
* @param usec Timeout. See waitq_sleep_timeout() for explanation. |
* @param flags Select mode of sleep operation. See waitq_sleep_timeout() for explanation. |
* @param flags Select mode of sleep operation. See waitq_sleep_timeout() |
* for explanation. |
* |
* @return Callid, if callid & 1, then the call is answer |
*/ |
519,7 → 526,8 |
call_t *call; |
|
restart: |
call = ipc_wait_for_call(&TASK->answerbox, usec, flags | SYNCH_FLAGS_INTERRUPTIBLE); |
call = ipc_wait_for_call(&TASK->answerbox, usec, |
flags | SYNCH_FLAGS_INTERRUPTIBLE); |
if (!call) |
return 0; |
|
574,7 → 582,8 |
* |
* @return EPERM or a return code returned by ipc_irq_register(). |
*/ |
unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode) |
unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, |
irq_code_t *ucode) |
{ |
if (!(cap_get(TASK) & CAP_IRQ_REG)) |
return EPERM; |