Mon, 10 Jun 2002 22:06:09 +0200, you wrote: > Manuel Menal wrote:
> 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 > ) Yeah, I agree. That's why I indicate you where to search. :-p > 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 ); Oh, it seems you are confused here. Let me quote from Mach 3 Kernel Principles, page 12: A port can only be accessed via a port right. A port right is an entity that indicates the right to access a specific port in a specific way. So, inserting a send right in the port doesn't make sense. You should've said something like: "create a send right to the port". Remember that the port is ``immaterial''. It is just ``materialized'' via port rights. The mach_port_t variable you have is _just_ a port right for a specific port. That's what you provide to mach_msg and other functions, and what mach_port_insert_right returns in its penultimate argument. > (3) fill the correct msgh_bits : > my_message.head.msgh_bits = MACH_MSGH_BITS( MACH_MSG_TYPE_MAKE_SEND ); Well, the MACH_MSGH_BITS macro takes 2 arguments. Remember page 335 of Mach 3 Kernel Interfaces. Either you should carry a send right (and make it via MACH_MSG_TYPE_MAKE_SEND) in the same message by which you carry your integer (you can have multiple mach_msg_type_name_t/data couple in your structure, so you can carry multiple things in a single message), either you create it via mach_port_insert_right. I think you should make as few Mach calls as possible, so it's maybe a good solution to just make _one_ message, and probably to do _both_ sending and receiving operation in the same mach_msg call, as described in the guides. This way you could have only 5 Mach calls (Cthreads call excluded) (or 4 if you decide to do it another, interesting, way, which is by using only one port and therefore using some cthreads structures to do some "scheduling", but you should only do it when you've already done the common way, with two ports). > 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 !! ). Depends on what you carry. See what I've said before. [snip] > 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... ) Heh, I'd like to have more knowledge, about everything and especially Mach and the Hurd, and to have more time so I can learn and help the Hurd! ;-) Bye, -- Manuel Menal _______________________________________________ Help-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-hurd