Changeset acf6b55 in mainline for kernel/generic/src/ipc/ipc.c


Ignore:
Timestamp:
2018-07-05T16:20:43Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
058c240
Parents:
bd9e868
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-04 23:32:32)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-05 16:20:43)
Message:

Make it possible for uspace to determine why SYS_IPC_WAIT returned.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipc.c

    rbd9e868 racf6b55  
    230230        }
    231231
    232         call_t *answer = ipc_wait_for_call(mybox, SYNCH_NO_TIMEOUT,
    233             SYNCH_FLAGS_INTERRUPTIBLE);
     232        call_t *answer = NULL;
     233        (void) ipc_wait_for_call(mybox, SYNCH_NO_TIMEOUT,
     234            SYNCH_FLAGS_INTERRUPTIBLE, &answer);
    234235        if (!answer) {
    235236
     
    267268                         * now.
    268269                         */
    269                         answer = ipc_wait_for_call(mybox, SYNCH_NO_TIMEOUT,
    270                             SYNCH_FLAGS_NONE);
     270                        (void) ipc_wait_for_call(mybox, SYNCH_NO_TIMEOUT,
     271                            SYNCH_FLAGS_NONE, &answer);
    271272                }
    272273        }
     
    536537 *              waitq_sleep_timeout() for description of its special
    537538 *              meaning.
    538  *
    539  * @return Recived call structure or NULL.
     539 * @param call  Received call structure or NULL.
     540 *
     541 * @return Error code from waitq_sleep_timeout.
     542 *         ENOENT if sleep returns successfully, but there is no call.
    540543 *
    541544 * To distinguish between a call and an answer, have a look at call->flags.
    542545 *
    543546 */
    544 call_t *ipc_wait_for_call(answerbox_t *box, uint32_t usec, unsigned int flags)
     547errno_t ipc_wait_for_call(answerbox_t *box, uint32_t usec, unsigned int flags,
     548    call_t **call)
    545549{
    546550        call_t *request;
     
    552556        rc = waitq_sleep_timeout(&box->wq, usec, flags, NULL);
    553557        if (rc != EOK)
    554                 return NULL;
     558                return rc;
    555559
    556560        irq_spinlock_lock(&box->lock, true);
     
    594598                 */
    595599                irq_spinlock_unlock(&box->lock, true);
    596                 return NULL;
     600                return ENOENT;
    597601        }
    598602
     
    605609        irq_spinlock_unlock(&TASK->lock, true);
    606610
    607         return request;
     611        *call = request;
     612        return EOK;
    608613}
    609614
     
    779784{
    780785        while (atomic_get(&TASK->answerbox.active_calls) != 0) {
    781                 call_t *call = ipc_wait_for_call(&TASK->answerbox,
    782                     SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
     786                call_t *call = NULL;
     787                if (ipc_wait_for_call(&TASK->answerbox,
     788                    SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE, &call) == ENOENT)
     789                        continue;
     790                assert(call);
    783791                assert(call->flags & (IPC_CALL_ANSWERED | IPC_CALL_NOTIF));
    784792
Note: See TracChangeset for help on using the changeset viewer.