bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: client-server-IPC


From: Marcus Brinkmann
Subject: Re: client-server-IPC
Date: Mon, 2 Dec 2002 19:45:24 +0100
User-agent: Mutt/1.4i

On Mon, Dec 02, 2002 at 06:22:33PM -0800, Frank Saar wrote:
> <---------------------------------------client-------------------->
> int main() {
>       int r=3;
>       error_t err;
>       mach_port_t server;
>       server=file_name_lookup("/servers/testserver",0,0);
>       if (server==MACH_PORT_NULL) {
>               error(1,errno,"Couldnt open server port\n");

Use "err" instead errno here, and you get the strerror for that IPC error. 
The error_t type includes all POSIX error values, but also all errors from
Mach and MiG.

>               error(1,errno,"get_random failed %d\n",err);

Same here.

>       ports_manage_port_operations_multithread (pi->bucket, test_server, 
> 0,0,0);

Try to write a demuxer that calls test_server() || trivfs_demuxer(),
so that you get the other RPCs handled, too.  I think the parent filesystem will
call the fsys_getroot() RPC on the server, and the error message you are
seeing might be from that RPC rather than yours.
 
>   return 0;
> }
> --------------------------------------------------------------------------
> But when I copy the server to /servers/testserver and run the client I get
> get_random_failed -303 as error.

-303 is MIG_BAD_ID, that means the message ID was one not understood by the
server.  It rejected the message.  But that might be a different message
from the get_random message, depending on where the error is returned (you
didn't give enough details).

> I mean its quite clear that the server must be running. So I started it
> before the client as a background process. So where´s problem ?

Attach gdb to the server process and set a breakpoint at test_server.  Then
you see all incoming messages, and you will see what happens. 
Alternatively, use rpctrace to debug first the client, and if that looks ok,
then the server by installing it as the translator:

settrans -a /tmp/test /bin/rpctrace -o /tmp/test.out /hurd/testserver ...

Note that rpctrace is a bit buggy, but it's worth a try.  GDB is more
powerful of course.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus@gnu.org
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]