bug-hurd
[Top][All Lists]
Advanced

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

Re: How to clone a port right


From: Sergiu Ivanov
Subject: Re: How to clone a port right
Date: Wed, 8 Jul 2009 18:10:28 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

Hello,

On Wed, Jul 08, 2009 at 04:33:02PM +0200, Carl Fredrik Hammar wrote:
> On Tue, Jul 07, 2009 at 09:24:27PM +0300, Sergiu Ivanov wrote:
> >   /* Opens the port on which to set the mountee.  */
> >   error_t
> >     open_port (int flags, mach_port_t * underlying,
> >                mach_msg_type_name_t * underlying_type, task_t task,
> >                void *cookie)
> >   {
> >     err = 0;
> > 
> >     /* Create a port to `np`.  */
> >     newpi = netfs_make_protid
> >       (netfs_make_peropen (np, flags, NULL), user);
> >     if (!newpi)
> >       {
> >         iohelp_free_iouser (user);
> >         return errno;
> >       }
> > 
> >     *underlying = underlying_port = ports_get_send_right (newpi);
> >     *underlying_type = MACH_MSG_TYPE_COPY_SEND;
> > 
> >     ports_port_deref (newpi);
> > 
> >     return err;
> >   }                             /*open_port */
> > 
> > [...]
> >
> > Now the question: can the reason for such failure be the fact that the
> > port right stored in underlying_node is used both in unionmount and in
> > the mountee?  If so, is there a way to clone the port right?
> 
> This issue has been resolved in IRC, but I'll answer the question
> for the record.  The port right is copied by mach_msg, if its type
> is MACH_MSG_TYPE_COPY_SEND.  And this is the type you passed in
> UNDERLYING_TYPE, so it is copied.  To move it you use ..._MOVE_SEND,
> you can also create a send right from a receive right with ..._MAKE_SEND.

Aha, clear, thank you. I understand the general meaning of port right
types, but now I've got a better idea of what's happening.

Regards,
scolobb




reply via email to

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