Changeset 2d11a7d8 in mainline for uspace/app/tester/ipc/connect.c
- Timestamp:
- 2009-06-30T15:54:14Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9c40f883
- Parents:
- db24058
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/ipc/connect.c
rdb24058 r2d11a7d8 29 29 #include <stdio.h> 30 30 #include <unistd.h> 31 #include <atomic.h> 31 32 #include "../tester.h" 32 33 33 char * test_connect(bool quiet) 34 static atomic_t finish; 35 36 static void callback(void *priv, int retval, ipc_call_t *data) 34 37 { 35 char c; 36 int svc; 37 int phid; 38 atomic_set(&finish, 1); 39 } 38 40 39 printf("Choose one service: 0:10000....9:10009 (q to skip)\n"); 40 do { 41 c = getchar(); 42 if ((c == 'Q') || (c == 'q')) 43 return TEST_SKIPPED; 44 } while (c < '0' || c > '9'); 41 char *test_connect(void) 42 { 43 TPRINTF("Connecting to %u...", IPC_TEST_SERVICE); 44 int phone = ipc_connect_me_to(PHONE_NS, IPC_TEST_SERVICE, 0, 0); 45 if (phone > 0) { 46 TPRINTF("phoneid %d\n", phone); 47 } else { 48 TPRINTF("\n"); 49 return "ipc_connect_me_to() failed"; 50 } 45 51 46 svc = IPC_TEST_START + c - '0';47 i f (svc == myservice)48 return "Currently cannot connect to myself, update test";52 printf("Sending synchronous message...\n"); 53 int retval = ipc_call_sync_0_0(phone, IPC_TEST_METHOD); 54 TPRINTF("Received response to synchronous message\n"); 49 55 50 printf("Connecting to %d..", svc); 51 phid = ipc_connect_me_to(PHONE_NS, svc, 0, 0); 52 if (phid > 0) { 53 printf("phoneid: %d\n", phid); 54 phones[phid] = 1; 55 } else 56 return "Error"; 56 TPRINTF("Sending asynchronous message...\n"); 57 atomic_set(&finish, 0); 58 ipc_call_async_0(phone, IPC_TEST_METHOD, NULL, callback, 1); 59 while (atomic_get(&finish) != 1) 60 TPRINTF("."); 61 TPRINTF("Received response to asynchronous message\n"); 62 63 TPRINTF("Hanging up..."); 64 retval = ipc_hangup(phone); 65 if (retval == 0) { 66 TPRINTF("OK\n"); 67 } else { 68 TPRINTF("\n"); 69 return "ipc_hangup() failed"; 70 } 57 71 58 72 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.