Manuel Menal wrote:

>Sun, 09 Jun 2002 22:56:35 +0200, you wrote: 
>
> > Hello! I would need some help with Mach IPC ( without using MIG, only the
> > syscalls for IPC ); I was writing
> > some example programs with the purpose to learn about Mach IPC, and now I'm
> > blocked and don't know
> > how to continue. I hope that somewhat could help me in this mailing list.
>
>That is probably a good place to ask help. :-)
>
Thanks for your answer, it has been somewhat useful ;-) , but not 
completly, :-(  !!

> >  the gnumach reference manuals, and "A
> > programmer's guide to the mach
> > system calls", that treats about mach 2.5 IPC wo MIG;
>
>Never heard of that book. Is it still published?
>
You can obtain it from here :

http://www-2.cs.cmu.edu/afs/cs/project/mach/public/www/doc/tutorials.html

I've tried to update the code with the description of the mach_msg 
function, and
the mach_msg_header_t and mach_msg_type_t structures described in the 
kernel interfaces
document that you have mencioned.

>That seems the right way to me. At least, the idea is correct. Not sure
>you filled the right fields with the correct values, though ;-)
>  
>
Yes, that's my problem!

>
>Just before I try to see what's wrong with your code: could you please
>use the GNU Coding Standards[1] ? That would make your code so easier :). 
>  
>
Sorry!!... it was a little example written for learning purposes; I have 
changed the code again, but I still
didn't adhere to GNU coding standards, since I had not enoungh time in 
this lunch time break!
Don't worry, I'll follow your advices. Thanks ;-) !

> >     /* Header of the message : */   
>       
> >     my_message.head.msgh_size = sizeof(struct simple_message);
>       
> >     /* my_message.head.msgh_local_port = mach_task_self(); */
> >     my_message.head.msgh_local_port = MACH_PORT_NULL;
> >     my_message.head.msgh_remote_port = my_port;
> >     /* my_message.head.msgh_id = 0x1234; */
>
>You must fill some other fields too. msgh_bits _must_ be filled with the
>appropriate value. You should read « Mach 3 Kernel Interfaces » [2],
>page 327.
>
Aha! I have made some changes to the original program with the purpose
of obtaining what is the error that happens :

    /* OK, time to send the message : */
    err = mach_msg( &(my_message.head), MACH_SEND_MSG, my_message.head.msgh_size, 
                    0, MACH_PORT_NULL, 
                    MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL );
                        
    /* Error analysis : */
    if( err == MACH_MSG_SUCCESS )
        printf( "Success : the message was queued\n" );
    else if( err == MACH_SEND_MSG_TOO_SMALL )
        printf( "Error : send_size smaller than the minimum\n" );
    else if( err == MACH_SEND_NO_BUFFER )
        printf( "Error : there was some resource shortage on the system\n" );
    else if( err == MACH_SEND_INVALID_DATA )
        printf( "Error : buffer message not readable\n" );
    else if( err == MACH_SEND_INVALID_HEADER )
        printf( "Error : msgh_bits value is invalid\n" );
    else
        printf( "Error : code returned is %d\n", err );


and, as you have pointed, I get a "MACH_SEND_INVALID_HEADER" error code!
I have tried some few things to fill this msgh_bits field correctly, but 
I'm afraid
that I'm still not prepared; some help will be apreciated, but maybe it 
would be
more interesting that me by-myself try todiscover how to fill correctly 
this field.

>Oh, and. Your example looks like the one described in
>http://web.walfield.org/pub/people/neal/papers/hurd-misc/mach-ipc-without-mig.txt,
>except that it has no threads. You should have a look at it, it has good
>explainations, and good references. Don't look at the solution, that
>would be cheating! :-)
>
>Bye,
>
Of course I'm trying to solve that problem, but I decided to go step by 
step. Then in my first
tries there are no threads created.

I'm thinking that maybe another source of problems would come because
the program has no rights to send a message to the port I have already 
created....
but no idea!, I'm just a newbie in Mach Programming!

>
>[1]: http://www.gnu.org/prep/standards_toc.html
>[2]: http://www-2.cs.cmu.edu/afs/cs/project/mach/public/www/doc/osf.html
>
>  
>
This time better no to torture nobody sending the source of my programs;
anyway I have no made many changes!

Thanks for the Help!





_______________________________________________
Help-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-hurd

Reply via email to