Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1060 → Rev 1061

/uspace/trunk/ns/ns.c
24,6 → 24,11
service = IPC_GET_ARG3(call.data);
retval = 0;
break;
case IPC_M_CONNECTMETO:
printf("Somebody wants to connect to: %d\n",
IPC_GET_ARG1(call.data));
retval = 0;
break;
case NS_PING:
printf("Ping...%P %P\n", IPC_GET_ARG1(call.data),
IPC_GET_ARG2(call.data));
/uspace/trunk/libipc/include/ipc.h
64,5 → 64,6
ipc_async_callback_t callback);
int ipc_connect_to_me(int phoneid, int arg1, int arg2,
unsigned long long *taskid);
int ipc_connect_me_to(int phoneid, int arg1, int arg2);
 
#endif
/uspace/trunk/libipc/generic/ipc.c
245,3 → 245,10
return __SYSCALL4(SYS_IPC_CONNECT_TO_ME, phoneid, arg1, arg2,
(sysarg_t) taskid);
}
 
/** Ask through phone for a new connection to some service */
int ipc_connect_me_to(int phoneid, int arg1, int arg2)
{
return __SYSCALL3(SYS_IPC_CONNECT_ME_TO, phoneid, arg1, arg2);
}
 
/uspace/trunk/init/init.c
144,11 → 144,12
unsigned long long taskid;
ipc_callid_t callid;
ipc_call_t data;
int i;
 
printf("Asking 0 to connect to me...\n");
res = ipc_connect_to_me(0, 1, 2, &taskid);
printf("Result: %d - taskid: %Q\n", res, taskid);
// while (1) {
for (i=0; i < 100; i++) {
printf("----------------\n");
ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov",
got_answer_2);
155,10 → 156,24
callid = ipc_wait_for_call(&data, NULL);
printf("Received ping\n");
ipc_answer(callid, 0, 0, 0);
// }
callid = ipc_wait_for_call(&data, NULL);
}
callid = ipc_wait_for_call(&data, NULL);
}
 
static void test_connection_ipc(void)
{
int res;
ipcarg_t result;
 
printf("Starting connect...\n");
res = ipc_connect_me_to(PHONE_NS, 10, 20);
printf("Connected: %d\n", res);
printf("pinging.\n");
res = ipc_call_sync(res, NS_PING, 0xbeef,&result);
printf("Retval: %d - received: %P\n", res, result);
}
 
int main(int argc, char *argv[])
{
version_print();
166,6 → 181,7
/* test_printf(); */
// test_ping();
// test_async_ipc();
test_advanced_ipc();
// test_advanced_ipc();
test_connection_ipc();
return 0;
}