Changeset b666608 in mainline for kernel/generic/src/ipc/sysipc.c


Ignore:
Timestamp:
2010-12-12T13:49:35Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4c74ac3
Parents:
94c19b8 (diff), 0c05496 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge from usb/development into smekideki

File:
1 edited

Legend:

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

    r94c19b8 rb666608  
    644644}
    645645
    646 /** Check that the task did not exceed the allowed limit of asynchronous calls.
    647  *
     646/** Check that the task did not exceed the allowed limit of asynchronous calls
     647 * made over a phone.
     648 *
     649 * @param phone Phone to check the limit against.
    648650 * @return 0 if limit not reached or -1 if limit exceeded.
    649651 *
    650652 */
    651 static int check_call_limit(void)
    652 {
    653         if (atomic_preinc(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) {
    654                 atomic_dec(&TASK->active_calls);
     653static int check_call_limit(phone_t *phone)
     654{
     655        if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
    655656                return -1;
    656         }
    657657       
    658658        return 0;
     
    680680    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
    681681{
    682         if (check_call_limit())
    683                 return IPC_CALLRET_TEMPORARY;
    684        
    685682        phone_t *phone;
    686683        if (phone_get(phoneid, &phone) != EOK)
    687684                return IPC_CALLRET_FATAL;
     685
     686        if (check_call_limit(phone))
     687                return IPC_CALLRET_TEMPORARY;
    688688       
    689689        call_t *call = ipc_call_alloc(0);
     
    720720unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data)
    721721{
    722         if (check_call_limit())
    723                 return IPC_CALLRET_TEMPORARY;
    724        
    725722        phone_t *phone;
    726723        if (phone_get(phoneid, &phone) != EOK)
    727724                return IPC_CALLRET_FATAL;
     725
     726        if (check_call_limit(phone))
     727                return IPC_CALLRET_TEMPORARY;
    728728
    729729        call_t *call = ipc_call_alloc(0);
     
    10461046                        ipc_call_free(call);
    10471047                        goto restart;
    1048                 } else {
    1049                         /*
    1050                          * Decrement the counter of active calls only if the
    1051                          * call is not an answer to IPC_M_PHONE_HUNGUP,
    1052                          * which doesn't contribute to the counter.
    1053                          */
    1054                         atomic_dec(&TASK->active_calls);
    10551048                }
    10561049               
Note: See TracChangeset for help on using the changeset viewer.