Changeset 05ffb41 in mainline for kernel/generic/src/ipc/ipc.c
- Timestamp:
- 2017-08-17T19:11:14Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1c85bae
- Parents:
- 7e3826d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ipc.c
r7e3826d9 r05ffb41 43 43 #include <synch/waitq.h> 44 44 #include <ipc/ipc.h> 45 #include <ipc/ipcrsc.h> 45 46 #include <abi/ipc/methods.h> 46 47 #include <ipc/kbox.h> … … 740 741 * Locking is needed as there may be connection handshakes in progress. 741 742 */ 742 for (i = 0; i < IPC_MAX_PHONES; i++) { 743 phone_t *phone = &TASK->phones[i]; 744 745 mutex_lock(&phone->lock); 743 for (i = 0; i < MAX_KERNEL_OBJECTS; i++) { 744 phone_t *phone = phone_get_current(i); 745 if (!phone) 746 continue; 747 748 mutex_lock(&phone->lock); 746 749 if ((phone->state == IPC_PHONE_HUNGUP) && 747 750 (atomic_get(&phone->active_calls) == 0)) { … … 784 787 785 788 /* Got into cleanup */ 786 if (i == IPC_MAX_PHONES)789 if (i == MAX_KERNEL_OBJECTS) 787 790 return; 788 791 … … 816 819 817 820 /* Disconnect all our phones ('ipc_phone_hangup') */ 818 for (size_t i = 0; i < IPC_MAX_PHONES; i++) 819 ipc_phone_hangup(&TASK->phones[i]); 821 for (int i = 0; i < MAX_KERNEL_OBJECTS; i++) { 822 phone_t *phone = phone_get_current(i); 823 if (!phone) 824 continue; 825 ipc_phone_hangup(phone); 826 } 820 827 821 828 /* Unsubscribe from any event notifications. */ … … 903 910 irq_spinlock_exchange(&tasks_lock, &task->lock); 904 911 905 printf("[phone id] [calls] [state\n");912 printf("[phone cap] [calls] [state\n"); 906 913 907 914 size_t i; 908 for (i = 0; i < IPC_MAX_PHONES; i++) { 909 if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) { 915 for (i = 0; i < MAX_KERNEL_OBJECTS; i++) { 916 phone_t *phone = phone_get(task, i); 917 if (!phone) 918 continue; 919 920 if (SYNCH_FAILED(mutex_trylock(&phone->lock))) { 910 921 printf("%-10zu (mutex busy)\n", i); 911 922 continue; 912 923 } 913 924 914 if ( task->phones[i].state != IPC_PHONE_FREE) {915 printf("%-1 0zu %7" PRIun " ", i,916 atomic_get(& task->phones[i].active_calls));925 if (phone->state != IPC_PHONE_FREE) { 926 printf("%-11zu %7" PRIun " ", i, 927 atomic_get(&phone->active_calls)); 917 928 918 switch ( task->phones[i].state) {929 switch (phone->state) { 919 930 case IPC_PHONE_CONNECTING: 920 931 printf("connecting"); … … 922 933 case IPC_PHONE_CONNECTED: 923 934 printf("connected to %" PRIu64 " (%s)", 924 task->phones[i].callee->task->taskid,925 task->phones[i].callee->task->name);935 phone->callee->task->taskid, 936 phone->callee->task->name); 926 937 break; 927 938 case IPC_PHONE_SLAMMED: 928 printf("slammed by %p", 929 task->phones[i].callee); 939 printf("slammed by %p", phone->callee); 930 940 break; 931 941 case IPC_PHONE_HUNGUP: 932 printf("hung up by %p", 933 task->phones[i].callee); 942 printf("hung up by %p", phone->callee); 934 943 break; 935 944 default: … … 940 949 } 941 950 942 mutex_unlock(& task->phones[i].lock);951 mutex_unlock(&phone->lock); 943 952 } 944 953
Note:
See TracChangeset
for help on using the changeset viewer.