help-hurd
[Top][All Lists]
Advanced

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

Re: Trying to.... It's amazing and it works!


From: Manu Valderrama
Subject: Re: Trying to.... It's amazing and it works!
Date: Mon, 10 Jun 2002 22:06:09 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Manuel Menal wrote:

> Thanks for your answer, it has been somewhat useful ;-) , but not completly, 
:-(

Heh, I'm not gonna do _your_ exercise, I've already done it a few times ;P

Of course not, but in some sense almost ! The good clues help very much ( or must I say mach ) :-)


Yup, that's the main problem, but I'm not sure I should help you for
this. It is all in the guides. :-)

[snip]

Yes, is all in the guides; but they are a bit difficult to read sometimes, especially when there are no examples! ( also if you are somewhat impatient; learning is gradual )


> 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.

Yup, I think so. Don't forget, though, that you only have a receive
right right now, and that you need to make a send right in order to send
a message; there are several ways to do it, as you can see in the
manuals: via mach_msg and MACH_MSG_TYPE_MAKE_SEND, or via
mach_port_insert_right (that one is in Kernel Interfaces too).

Just the little help I was needing ; although I must admit that I have had
very much good luck. This was finally the keys to solve the problem :

(1) allocate the port :

mach_port_allocate( mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &receive_port );

(2) insert a send right in the port :

mach_port_insert_right( mach_task_self(), receive_port, MACH_PORT_RIGHT_SEND,
MACH_PORT_NULL );
(3) fill the correct msgh_bits :

my_message.head.msgh_bits = MACH_MSGH_BITS( MACH_MSG_TYPE_MAKE_SEND );

but the happyness is not complete; as you ( or anybody that knows enough about mach ) would appreciate, I filled all the "mach_msg_type_name_t" variables with random values until the code worked ( -> MACH_MSG_TYPE_MAKE_SEND; I think it does not make very much sense
in the msgh_bits field !! ).

Now that I have satisfied my impatience, and some of my curiosity, it's time to think about the last
issue.

Anycase, very much help you for your so much useful help :-).
"May God pay you it with many <soons>!" ( a traduction of a spanish
expression; I suspect that does not sound very good in english.
Feel free of change the <soons> field by whatever you want... )


You're welcome!

Bye,

Thank you again; and bye too!!






reply via email to

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